Using crossdev-0.19 with '-S -s1 --gcc 3.3.6-r1' to build toolchain for arm-linux-uclibc on x86 host fails when building gcc stage 1 (see attached log). Reproducible: Always Steps to Reproduce: 1. crossdev -S -s1 --gcc 3.3.6-r1 arm-linux-uclibc 2. 3. Actual Results: Output from crossdev: ericisko ~ # crossdev -S -s1 --gcc 3.3.6-r1 arm-linux-uclibc ------------------------------------------------------------------------------------------------------ * Host Portage ARCH: x86 * Target Portage ARCH: arm * Target System: arm-linux-uclibc * Stage: 1 (C compiler only) * binutils: binutils-[stable] * gcc: gcc-3.3.6-r1 * PORTDIR_OVERLAY: /usr/portage/local * PORT_LOGDIR: /var/log/portage * PKGDIR: /usr/portage/packages/cross/arm-linux-uclibc * PORTAGE_TMPDIR: /media/cross/arm-linux-uclibc _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - * Using sys-devel/binutils from /usr/portage/local instead of /usr/portage * Forcing the latest versions of {binutils,gcc}-config/gnuconfig ... [ ok ] * Log: /var/log/portage/cross-arm-linux-uclibc-binutils.log * Emerging cross-binutils ... [ ok ] * Log: /var/log/portage/cross-arm-linux-uclibc-linux-headers-quick.log * Emerging cross-linux-headers-quick ... [ ok ] * Log: /var/log/portage/cross-arm-linux-uclibc-uclibc-headers.log * Emerging cross-uclibc-headers ... [ ok ] * Log: /var/log/portage/cross-arm-linux-uclibc-gcc-stage1.log * Emerging cross-gcc-stage1 ... * gcc failed :( * If you file a bug, please attach the following logfiles: * /var/log/portage/cross-arm-linux-uclibc-info.log * /var/log/portage/cross-arm-linux-uclibc-gcc-stage1.log Expected Results: gcc stage1 compiled successfully. The issue seems to be that 'xgcc' (built as part of gcc build) fails to find cross-compiled binutils: ./xgcc -print-prog-name=as returns 'as' instead of '/usr/libexec/gcc/arm-linux-uclibc/as' Forcing '/usr/libexec/gcc/arm-linux-uclibc/' directory to 'exec_prefixes' list in gcc.c resolves the issue (see attached patch) - I know this is not the correct way to fix the issue, it's just to show that once 'xgcc' finds cross-binutils, gcc stage1 build will finish.
Created attachment 179786 [details] crossdev log
Created attachment 179787 [details] gcc stage1 build log
Created attachment 179790 [details, diff] Patch for gcc.c
Created attachment 179804 [details, diff] Corrected patch for gcc.c
Comment on attachment 179804 [details, diff] Corrected patch for gcc.c nothing like this will be merged
gcc-3.3 isnt supported anymore for uclibc. just use gcc-3.4. if you do find the real root cause and post a patch, i'll consider it though ...
(In reply to comment #5) > (From update of attachment 179804 [details, diff] [edit]) > nothing like this will be merged > This patch was never intended to be merged. It was sort of 'proof of concept'. (In reply to comment #6) > gcc-3.3 isnt supported anymore for uclibc. just use gcc-3.4. > > if you do find the real root cause and post a patch, i'll consider it though > ... > I believe root cause is that GCC-3.3.6's compiled-in list of search directories does not contain path to cross-binutils. As GCC cannot find e.g. 'as' anywhere in its search path, it will use 'as' as assembler command and the system's native assembler is used. GCC 4.1.2 has '/usr/libexec/gcc' prefix in the list of exec_prefixes compiled in (see gcc/gcc.c). Below is patch that will add '/usr/libexec/gcc' to exec_prefixes. It cross-compiled for arm-linux-uclibc successfully and I was able to compile code that ran on ARM. However, I compiled only stage 1 compiler (C only, no C++). Running 'arm-linux-uclibc-gcc -print-search-dirs' gives the output: install: /usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/ programs: =/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/:/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/:/usr/lib/gcc-lib/arm-linux-uclibc/:/usr/lib/gcc/arm-linux-uclibc/3.3.6/:/usr/lib/gcc/arm-linux-uclibc/:/usr/libexec/gcc/arm-linux-uclibc/3.3.6/:/usr/libexec/gcc/arm-linux-uclibc/:/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/../../../../arm-linux-uclibc/bin/arm-linux-uclibc/3.3.6/:/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/../../../../arm-linux-uclibc/bin/ libraries: =/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/:/usr/lib/gcc/arm-linux-uclibc/3.3.6/:/usr/libexec/gcc/arm-linux-uclibc/3.3.6/:/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/../../../../arm-linux-uclibc/lib/arm-linux-uclibc/3.3.6/:/usr/lib/gcc-lib/arm-linux-uclibc/3.3.6/../../../../arm-linux-uclibc/lib/:/usr/arm-linux-uclibc/lib/arm-linux-uclibc/3.3.6/:/usr/arm-linux-uclibc/lib/:/usr/arm-linux-uclibc/usr/lib/arm-linux-uclibc/3.3.6/:/usr/arm-linux-uclibc/usr/lib/ Notice '/usr/libexec/gcc/arm-linux-uclibc/' directory in the list. Running 'arm-linux-uclibc-gcc -print-prog-name=as' gives output: /usr/libexec/gcc/arm-linux-uclibc/as
Created attachment 180113 [details, diff] Patch to allow gcc-3.3.6 to cross-compile