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]

Re: linking correct libc


ng@piments.com wrote:
Yann E. MORIN wrote:
"ng",
All,

On Sunday 24 May 2009 22:09:27 ng@piments.com wrote:
Yann E. MORIN wrote:
It is *not* needed to pass --sysroot to the compielrs build with
crosstool-NG.
thanks, I realised that , it was an attempt to verofu what was happening by explicitly specifying everything. When it made no difference I concluded the built-in sysroot was correctly interpreted and the problem lay elsewhere.

So, your toolchain is working, and you are trying to reproduce gcc's internal
logic by passing args on the command line, right?


What does the follwing command says:
/back/ts/ct-wkg//x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc \
was something missed off after the \ :?

Yes, sorry: bla-bla-gcc -print-search-dirs
voila:

/back/ts/ct-wkg//x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc -print-search-dirs
install: /back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.3.2/


programs: =/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../libexec/gcc/arm-unknown-linux-gnueabi/4.3.2/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../libexec/gcc/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi/4.3.2/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/bin/

libraries: =/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.3.2/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/lib/arm-unknown-linux-gnueabi/4.3.2/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/lib/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../arm-unknown-linux-gnueabi//sys-root/lib/arm-unknown-linux-gnueabi/4.3.2/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../arm-unknown-linux-gnueabi//sys-root/lib/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../arm-unknown-linux-gnueabi//sys-root/usr/lib/arm-unknown-linux-gnueabi/4.3.2/:/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../arm-unknown-linux-gnueabi//sys-root/usr/lib/



/back/ts/ct-wkg//x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc \ -print-file-name=libc.so
/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../arm-unknown-linux-gnueabi//sys-root/usr/lib/libc.so



OK.


cat /back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/bin/../arm-unknown-linux-gnueabi//sys-root/usr/lib/libc.so

/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) )
OK , so that explains the reference to /lib/libc.so.6 , is that what you would expect to see here?

Yes, correct. Those are paths relative to the sysroot, so gcc will hapilly
find them.
BTW, notice: ld-linux.so.3 -> EABI-era dynamic linker, good.


To conclude this thread: does your toolchain correctly works by default?

Well it builds a bootable kernel and busybox but I can't get past this incompatible /lib/libc.so.6 error in portmap.


CPPFLAGS="-I/back/ts/root2/usr/include" LDFLAGS="-L/back/ts/root2/usr/lib/" make
arm-unknown-linux-gnueabi-gcc -L/back/ts/root2/usr/lib/ -pie portmap.o pmap_check.o from_local.o -lwrap -o portmap
/back/ts/ct-ng/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/back/ts/ct-ng/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/bin/ld: cannot find /lib/libc.so.6
collect2: ld returned 1 exit status
make: *** [portmap] Error 1



Since that /lib/libc.so.6 would appear to be the sys-root one and you say that file looks good, why is it crapping out and declaring this file "incompatible"?


Thanks again.


Regards,
Yann E. MORIN.




Hi Yann,


based on the information on this problem which seems pretty complete now , can you please explain why I am unable to compile this package?


>> To conclude this thread: does your toolchain correctly works by default?


What do you mean by "by default"? This is the minimum ammount of variables I need to supply to get some of the files to build upto the point were it declares libc.so.6 "incompatible".


echo $CC arm-unknown-linux-gnueabi-gcc

CFLAGS="-march=armv4t" CPPFLAGS="-I/back/ts/root2/usr/include" LDFLAGS="-L/back/ts/root2/usr/lib/" make
arm-unknown-linux-gnueabi-gcc -march=armv4t -Wall -Wstrict-prototypes -fpie -I/back/ts/root2/usr/include -DHOSTS_ACCESS -DCHECK_PORT -DIGNORE_SIGCHLD -DFACILITY=LOG_DAEMON -c -o portmap.o portmap.c
arm-unknown-linux-gnueabi-gcc -march=armv4t -Wall -Wstrict-prototypes -fpie -I/back/ts/root2/usr/include -DHOSTS_ACCESS -DCHECK_PORT -DIGNORE_SIGCHLD -DFACILITY=LOG_DAEMON -c -o pmap_check.o pmap_check.c
arm-unknown-linux-gnueabi-gcc -march=armv4t -Wall -Wstrict-prototypes -fpie -I/back/ts/root2/usr/include -DHOSTS_ACCESS -DCHECK_PORT -DIGNORE_SIGCHLD -DFACILITY=LOG_DAEMON -c -o from_local.o from_local.c
arm-unknown-linux-gnueabi-gcc -L/back/ts/root2/usr/lib/ -pie portmap.o pmap_check.o from_local.o -lwrap -o portmap
/back/ts/ct-ng/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/back/ts/ct-ng/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.3.2/../../../../arm-unknown-linux-gnueabi/bin/ld: cannot find /lib/libc.so.6
collect2: ld returned 1 exit status
make: *** [portmap] Error 1



So I would say : no, the toolchain is not working correctly in this case.




So I see a limited number of explainations.

1/ It is really finding /lib/libc.so.6 (ie the host x86 library) as indicated by the output but contrary to the -print-search-dirs paths.

2/ It is looking in the right place but finding something different to what is expected.

3/ It is finding a good libc but erroneously calling it incompatible.

4/ It is finding another libc in the search path but there is not:
find /back/ts/ct-wkg/x-tools -iname libc.so.6


/back/ts/ct-wkg/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-root/lib/libc.so.6

5/ I'm making some dumb error in using the toolchain.


If it was 5/ I'm sure you would have told me by now so I'm left with the conclusion that there is problem with the toolchain.




thanks again, Peter.






-- 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]