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: libc.so GROUP Statement


Hello Doug!
Hello All!

On Tuesday 29 December 2009 18:28:10 Doug Kehn wrote:
> I'm building arm-cortex_a8-linux-gnueabi with crosstool-ng-1.5.2.
> The resulting libc.so contains: 
> 
> /* 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 ) )

This is (should be!) black magic used by glibc, and is to be interpreted
relative to the sysroot.

> Cross compiling some applications I receive the following error:
> .../arm-cortex_a8-linux-gnueabi/bin/ld: cannot find /usr/lib/libc_nonshared.a
> collect2: ld returned 1 exit status

How do you call your compiler? If you did set CT_PREFIX_DIR to (eg.):
  /opt/toolchain

Then you call the compiler with :
  /opt/toolchain/bin/arm-cortex_a8-linux-gnueabi-gcc

Ot you set PATH="${PATH}:/opt/toolchain/bin" and you call:
  arm-cortex_a8-linux-gnueabi-gcc

Do *not* call gcc like that:
  /opt/toolchain/arm-cortex_a8-linux-gnueabi/bin/gcc

> If I manually change the GROUP statement in libc.so to:
> GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )
> the applications cross compile without error.

This is an error. As I said, the paths in GROUP are relative to the
sysroot, and gcc should find them (if called as above).

> Am I doing something wrong when cross compiling the applications?
> 
> The arm-cortex_a8-linux-gnueabi crosstool.config has CT_USE_SYSROOT=y
> (and CT_SYSROOT_DIR_PREFIX=""). I thought the path in the libc.so GROUP
> statement would be pointing to the toolchain's sysroot directory.

Hehe! glibc's black magic. See:
  http://www.gnu.org/software/libc/manual/html_node/Linux.html
around the end of the page.

> I'm basing this on glibc.sh running make with install_root=$(CT_SYSROOT_DIR).
> Am I not reading the script correctly?

Yes, that in the end is telling glibc to strip 'install_root' from the
paths, so that when you move the toolchain around, the sysroot stuff
continues to work. The toolchain is thus relocatable.

> Is there a way to configure the toolchain to alter the paths in the
> libc.so GROUP statement?

I never needed to do that, and most important, in my understanding, that
would break glibc.

Please, confirm the way you are calling the compiler, and if you indeed
call it the way I explained above, then we'll see for a proper fix.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



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