Massimiliano Pagani

Ltib / Kubuntu 12.04 / problem in building linux image for iMx53

Discussion created by Massimiliano Pagani on Jul 6, 2012

Hi all,

I am setting up my development environment for iMx53. I picked the last Kubuntu (12.04 LTS) which already provides a proper arm toolchain (arm-linux-gnueabi-gcc 4.6.3) e the latest Freescale Linux source bundle (L2.6.35_11.09.01_ER_source_bundle.tar.gz).

I had to make some modifications to get ltib running (changes listed below). Now I got past the configuration menu and a certain number of packages properly built. The problems started with busybox. Ltib stopped complaining -

Error: failed dependencies:

ld-linux.so.3(GLIBC_2.4)   is needed by busybox-1.18.5

libc.so.6(GLIBC_2.4)   is needed by busybox-1.18.5

 

I then run the following sequence -

./ltib -s -m prep -p busybox

./ltib -s -m scbuild -p busybox

./ltib -s -m scinstall -p busybox

./ltib -s -m scdeploy -p busybox

 

and the little devil got everything correct. That is - the first time ltib fails, but if I force it to go step by step, then the package is built, installed and deployed correctly.

 

The same happened for libtermcap, bash and zlib... and I am afraid that could go for the rest of the packages. Also I am a little scared about the resulting image being not properly operative.

 

Is there anything I am doing wrong? Or is there a way to fix the ltib processing?

On a side track - is there something in my configuration that is not advisable or that may be troublesome? Thank you.

 

Here's my list of changes

-----

#!/bin/bash

cd $HOME/Projects/freescale/ltib

patch -p0 <<EOF

--- old.bin/Ltibutils.pm 2012-07-04 16:04:38.213317384 +0200

+++ bin/Ltibutils.pm 2012-07-04 16:08:25.421790226 +0200

@@ -587,7 +587,8 @@

glob('/lib64/libz.so*'),

glob('/usr/lib/i386-linux-gnu/libz.so*'),

glob('/usr/lib32/libz.so*'),

- glob('/usr/lib/x86_64-linux-gnu/libz.so*') ); @f > 1 ? 1 : 0 },

+ glob('/usr/lib/x86_64-linux-gnu/libz.so*'),

+ glob('/usr/lib/i386-linux-gnu/libz.so' )); @f > 1 ? 1 : 0 },

'zlib-devel' => sub { -f '/usr/include/zlib.h' },

};

EOF

patch -p0 <<EOF

--- dist/lfs-5.1/sparse/sparse.orig.spec 2012-07-05 12:38:01.513086691 +0200

+++ dist/lfs-5.1/sparse/sparse.spec 2012-07-05 12:35:08.777081217 +0200

@@ -33,6 +33,19 @@

%patch0 -p1

%build

+patch -p0 <<EOF

+--- parse.old.h 2012-07-05 12:33:06.113077325 +0200

++++ parse.h 2012-07-05 12:29:43.913070913 +0200

+@@ -60,7 +60,7 @@

+ };

+ struct /* labeled_struct */ {

+ struct symbol *label_identifier;

+- struct statement *label_statement;

++ struct statement *label_statement1;

+ };

+ struct /* case_struct */ {

+ struct expression *case_expression;

+EOF

make DESTDIR=$RPM_BUILD_ROOT PREFIX="%{pfx}/%{_prefix}" CFLAGS="%{optflags}"

%install

EOF

patch -p0 <<EOF

--- dist/lfs-5.1/mux_server/mux_server.orig.spec 2012-07-05 12:48:40.981106965 +0200

+++ dist/lfs-5.1/mux_server/mux_server.spec 2012-07-05 12:49:01.869107606 +0200

@@ -22,7 +22,7 @@

%patch0 -p1

%build

-%{__cc} %{optflags} -lpthread mux_server.c -o mux_server

+%{__cc} %{optflags} mux_server.c -o mux_server -lpthread

%install

EOF

patch -p0 <<EOF

--- dist/lfs-5.1/elftosb/elftosb.orig.spec 2012-07-05 12:57:24.609123560 +0200

+++ dist/lfs-5.1/elftosb/elftosb.spec 2012-07-05 12:58:10.401125015 +0200

@@ -21,6 +21,19 @@

%setup

%Build

+patch -p0 <<EOF

+--- common/stdafx.orig.h 2012-07-05 12:54:37.601118271 +0200

++++ common/stdafx.h 2012-07-05 12:55:16.377119498 +0200

+@@ -27,7 +27,7 @@

+ // For Linux systems only, types.h only defines the signed

+ // integer types. This is not professional code.

+ // Update: They are defined in the header files in the more recent version of redhat enterprise gcc.

+-#include "/usr/include/sys/types.h"

++//#include "/usr/include/sys/types.h"

+ #include <stdint.h>

+ //typedef unsigned long uint32_t;

+ //typedef unsigned short uint16_t;

+EOF

make

%Install

EOF

 

then I run ./ltib, then

#!/bin/bash

patch <<EOF

--- old.patch 2012-07-04 17:23:44.421877498 +0200

+++ /opt/freescale/pkgs/lkc-1.4-lxdialog.patch 2012-07-04 17:24:12.525878365 +0200

@@ -3122,7 +3122,7 @@

+ cd lxdialog && $(MAKE)

+

+mconf: $(mconf_OBJ) $(lxdialog_LIB)

-+ $(CC) $(LDFLAGS) $(mconf_LIBS) $^ -o $@

++ $(CC) $(LDFLAGS) $^ -o $@ $(mconf_LIBS)

conf: $(conf_OBJ)

$(CC) $(LDFLAGS) $^ -o $@

EOF

 

I had also to change the base_lib Spec file

#!/bin/bash

patch -p0 <<EOF

--- ltib/dist/lfs-5.1/base_libs/base_libs.old.spec    2011-09-20 11:24:28.000000000 +0200
+++ ltib/dist/lfs-5.1/base_libs/base_libs.spec    2012-07-06 12:11:04.251383163 +0200
@@ -99,11 +99,20 @@
     SHARED_LIBS_DIR="`dirname \`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libc.so.6\``"
 fi

-STATIC_LIBS_DIR="`dirname \`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libc.a\``"
-GCC_SLIB_DIR="`dirname \`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libgcc_s.so\``"
-CPP_LIB_DIR="`dirname \`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libstdc++.so\``"
-CPPSUP_LIB_DIR="`dirname \`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libsupc++.a\``"
-CRT_FILES_DIR="`dirname \`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=crti.o\``"
+echo "Here I am"
+
+# attempting to access the target directories rather than the symlinks
+file_libc=`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libc.a`
+file_libgcc_s=`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libgcc_s.so`
+file_libstdcc=`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libstdc++.so`
+file_libsupcc=`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=libsupc++.a`
+file_crt=`${TOOLCHAIN_PREFIX}gcc ${TOOLCHAIN_CFLAGS} -print-file-name=crti.o`
+
+STATIC_LIBS_DIR="`dirname \`readlink -m $file_libc\``"
+GCC_SLIB_DIR="`dirname \`readlink -m $file_libgcc_s\``"
+CPP_LIB_DIR="`dirname \`readlink -m $file_libstdcc\``"
+CPPSUP_LIB_DIR="`dirname \`readlink -m $file_libsupcc\``"
+CRT_FILES_DIR="`dirname \`readlink -m $file_crt\``"

 # create output directories in a dash compatible way
 for i in etc usr/bin sbin usr/sbin lib usr/lib usr/share usr/include
@@ -309,6 +318,28 @@
       $RPM_BUILD_ROOT/%{pfx}/usr/lib/libpthread.so

 cd $RPM_BUILD_ROOT/%{pfx}
+
+#for i in $(find -L lib usr/lib -type l )
+#do
+#    # $i is the broken link
+#    # $(readlink "$i") is the (broken) target
+#    link=`basename "$i"`
+#    target=`basename "\`readlink \"$i\"\``
+#    if [ "$link" = "$target" ]
+#    then
+#       # we've got a problem, maybe we can try to strip a trailing number
+#    else
+#       # try to fake
+#       ln -s "$target" "$i"
+#    fi
+#done
+
+# below is really a kludge to fix my build
+mv -f $RPM_BUILD_ROOT/%{pfx}/lib/libgcc_s.so $RPM_BUILD_ROOT/%{pfx}/lib/libgcc_s.so.1
+ln -s $RPM_BUILD_ROOT/%{pfx}/lib/libgcc_s.so.1 $RPM_BUILD_ROOT/%{pfx}/lib/libgcc_s.so
+rm -f $RPM_BUILD_ROOT/%{pfx}/lib/libnss_db.so
+
+
 # this is necessary to avoid annoying warnings from ldd about no execute
 # permissions for some malformed uClibc toolchains
 find $RPM_BUILD_ROOT/%{pfx}/lib     | xargs chmod 755

EOF

Outcomes