From: Kai Ruottu <karuottu@mbnet.fi>
To: Kaz Kylheku <kaz@zeugmasystems.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Gcc+binutils+libc cross-compiling: path to libc.so.6 malformed in "ld".
Date: Mon, 28 Aug 2006 09:18:00 -0000 [thread overview]
Message-ID: <44F2B7FD.6020807@mbnet.fi> (raw)
In-Reply-To: <66910A579C9312469A7DF9ADB54A8B7D365714@exchange.ZeugmaSystems.local>
Kaz Kylheku wrote :
> Solved!
>
> This problem is caused by a miscconfigured glibc build with an incorrect
> --prefix. The absolute paths are picked up from libc.so, which is just a
> linker script generated by glibc. This linker script must contain paths
> that are correct for the target system system. Of course, those paths
> don't work on the cross-compiling system, which is where the catenation
> with --sysroot comes in.
What I have thought being the aim in producing a "normal" glibc,
one which should work both as a "native" glibc, and as a "cross"
glibc, is using the '--prefix=/usr'. Then the install scheme includes
the '.../lib' and the '.../usr/lib'. In a native install the '.../' is
the '/'
and in a cross install it is the '$sysroot/'.
So the resulted 'libc.so' has just the same 'native' like pathnames :
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
and the 'libpthread.so' script too :
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )
And because of using the '--with-sysroot=$sysroot', the 'ld' interprets
these absolute paths to mean '$sysroot/lib/...' and '$sysroot/usr/lib/...' !
Otherwise the '--with-sysroot=' simply doesn't work "as expected"...
Being able to copy a glibc (plus the other target libraries) between the
native and the cross host(s) in 1-to-1 scheme (just as any other target C
libraries, the proprietary ones don't even have any sources so copying
them is the only possibility... And of course rebuilding already built libs
for the Linux distros is quite stupid!) should be the motive for using the
'--with-sysroot=' ! Traditionally this hasn't succeeded, fixing some
things
has been obligatory because the cross GCC scheme knows only one 'lib'.
If you use the '--prefix=/usr' in your glibc configure and use the
suggested
make install_root=$sysroot
to install it below the $sysroot, the glibc should be there waiting that
1-to-1 copying onto the native target system. And should work in your
crosstoolchain, that configured using the '--with-sysroot=$sysroot' !
next prev parent reply other threads:[~2006-08-28 9:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-25 17:56 Kaz Kylheku
2006-08-28 9:18 ` Kai Ruottu [this message]
2006-08-28 9:52 ` Kai Ruottu
-- strict thread matches above, loose matches on Subject: below --
2006-08-29 4:29 Kaz Kylheku
2006-08-29 8:37 ` Kai Ruottu
2006-08-25 0:46 Kaz Kylheku
2006-08-24 19:04 Kaz Kylheku
2006-08-24 5:03 Kaz Kylheku
2006-08-24 9:30 ` Kai Ruottu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44F2B7FD.6020807@mbnet.fi \
--to=karuottu@mbnet.fi \
--cc=gcc-help@gcc.gnu.org \
--cc=kaz@zeugmasystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).