This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[CT_NG] build fixes for glibc-2.3.6 and old systems


Hi Yann,

I was trying to build a toolchain with gcc-3.4.6 + glibc-2.3.6 using
crosstool-ng-1.1.0. My system is quite old (slackware 7 based) and
uses gcc-2.95.3. Running on such an old system reveals some minor
bugs quite easily.

First, I noticed that some erroneous links were created early in the
build process due to this code :

/usr/lib/ct-ng-1.1.0/scripts/crosstool.sh :

    CT_DoLog DEBUG "Making build system tools available"
    mkdir -p "${CT_PREFIX_DIR}/bin"
    for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do
        tmp=`CT_Which ${tool}`
        if [ -n "${tmp}" ]; then
            ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
            ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}"
            ln -sfv "${tmp}" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}"
        fi |CT_DoLog DEBUG
    done

It causes such broken links for non-existing tools, because "which" returns
an error message which is part of the link target :

rwxrwxrwx  1 willy users    554 May 10 14:34 i686-build_pc-linux-gnu-dlltool -> which: no dlltool in (/cross/i386-cross-linux-gnu/bin:/usr/src/crosstool/gcc-3.4.6-glibc-2.3.6/targets/i386-cross-linux-gnu/build/gcc-core-shared/bin:/usr/src/crosstool/gcc-3.4.6-glibc-2.3.6/targets/i386-cross-linux-gnu/build/gcc-core-static/bin:/var/flx-toolchain/i586-linux/tool-i686-host-linux/usr/bin:/usr/local/qt/bin:/usr/local/linuxprinter/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games:.:/opt/kde/bin:/usr/share/texmf/bin:/opt/mysql/bin:/opt/mysql/sbin:/opt/palinux/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin)


Also, ${CT_BUILD}-gcc points to the wrong gcc (/usr/bin/gcc) instead of
$CT_CC_NATIVE. Mine (2.95) cannot build glibc-2.3.6 while the gcc-3.3
I have in CT_CC_NATIVE can.

I noticed that binutils builds using "gcc" instead of the $CT_CC_NATIVE.
I did not find how to fix it in the makefile or scripts, so I temporarily
moved my /usr/bin/gcc symlink to gcc-3.3.

When installing libc headers, the wrong compiler is used (CT_TARGET)
instead of CT_BUILD, resulting in the headers not being built :

[ALL  ]    checking for i386-cross-linux-gnu-gcc... which: no i386-cross-linux-gnu-gcc in (/cross/i386-cross-linux-gnu/bin:/usr/src/crosstool/gcc-3.4.6-glibc-2.3.6/targets/i386-cross-linux-gnu/build/g
cc-core-shared/bin:/usr/src/crosstool/gcc-3.4.6-glibc-2.3.6/targets/i386-cross-linux-gnu/build/gcc-core-static/bin:/var/flx-toolchain/i586-linux/tool-i686-host-linux/usr/bin:/usr/local/qt/bin:/usr/loc
al/linuxprinter/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games:.:/opt/kde/bin:/usr/share/texmf/bin:/opt/mysql/bin:/opt/mysql/sbin:/opt/palinux/bin:/sbin:/usr/sbin:/usr/loc
al/sbin:/usr/local/bin)
[ERROR]    checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile

I fixed it with the following patch :

--- crosstool-ng-1.1.0/scripts/build/libc_glibc.sh	Sat May  3 19:51:16 2008
+++ /usr/lib/ct-ng-1.1.0/scripts/build/libc_glibc.sh	Sat May 10 14:54:15 2008
@@ -83,7 +83,7 @@
     addons_config="${addons_config//linuxthreads/}"
     addons_config=`echo "${addons_config}" |sed -r -e 's/^,+//; s/,+$//; s/,+/,/g;'`
 
-    cross_cc=`CT_Which "${CT_TARGET}-gcc"`
+    cross_cc=`CT_Which "${CT_BUILD}-gcc"`
     CT_DoLog DEBUG "Using gcc for target: \"${cross_cc}\""
     CT_DoLog DEBUG "Extra config passed : \"${addons_config}\""
 

Last, glibc-2.3.6 does not build unless glibc-2.3.6-csu-Makefile.patch
from crosstool SVN is applied. It seems it depends on the bash version
used. Mine is 3.00.16(1). The patch is said to be OK for everyone. It's
caused by "echo" not being portable, while "printf" is more strictly
defined. You can get it here BTW :

http://crosstool.googlecode.com/svn-history/r21/trunk/src/patches/glibc-2.3.6/glibc-2.3.6-csu-Makefile.patch

Otherwise, everything works great! Thanks for such a pleasant tool!

Regards,
Willy


--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]