Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 256435 - sys-devel/gcc-3.3.6-r1 fails to cross-compile for arm-linux-uclibc
Summary: sys-devel/gcc-3.3.6-r1 fails to cross-compile for arm-linux-uclibc
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-26 17:46 UTC by Erik Benada
Modified: 2009-01-29 15:07 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
crossdev log (cross-arm-linux-uclibc-info.log,11.30 KB, text/plain)
2009-01-26 17:49 UTC, Erik Benada
Details
gcc stage1 build log (cross-arm-linux-uclibc-gcc-stage1.log,639.10 KB, text/plain)
2009-01-26 17:50 UTC, Erik Benada
Details
Patch for gcc.c (gcc-exec-prefixes.patch,541 bytes, patch)
2009-01-26 17:54 UTC, Erik Benada
Details | Diff
Corrected patch for gcc.c (gcc-exec-prefixes.patch,503 bytes, patch)
2009-01-26 20:06 UTC, Erik Benada
Details | Diff
Patch to allow gcc-3.3.6 to cross-compile (gcc-3.3.6-exec-prefixes.patch,1.21 KB, patch)
2009-01-29 15:07 UTC, Erik Benada
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Benada 2009-01-26 17:46:47 UTC
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.
Comment 1 Erik Benada 2009-01-26 17:49:10 UTC
Created attachment 179786 [details]
crossdev log
Comment 2 Erik Benada 2009-01-26 17:50:55 UTC
Created attachment 179787 [details]
gcc stage1 build log
Comment 3 Erik Benada 2009-01-26 17:54:33 UTC
Created attachment 179790 [details, diff]
Patch for gcc.c
Comment 4 Erik Benada 2009-01-26 20:06:43 UTC
Created attachment 179804 [details, diff]
Corrected patch for gcc.c
Comment 5 SpanKY gentoo-dev 2009-01-28 22:55:27 UTC
Comment on attachment 179804 [details, diff]
Corrected patch for gcc.c

nothing like this will be merged
Comment 6 SpanKY gentoo-dev 2009-01-28 22:57:15 UTC
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 ...
Comment 7 Erik Benada 2009-01-29 15:04:40 UTC
(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
Comment 8 Erik Benada 2009-01-29 15:07:12 UTC
Created attachment 180113 [details, diff]
Patch to allow gcc-3.3.6 to cross-compile