This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: linker search directories
- To: Brendan dot Simon at ctam dot com dot au
- Subject: Re: linker search directories
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Tue, 25 Jan 2000 10:51:12 -0800
- CC: binutils at sourceware dot cygnus dot com, crossgcc at sourceware dot cygnus dot com
- References: <388E6475.FE3A64C5@ctam.com.au>
> Date: Wed, 26 Jan 2000 14:05:26 +1100
> From: Brendan John Simon <Brendan.Simon@ctam.com.au>
> Reply-To: Brendan.Simon@ctam.com.au
> Organization: CTAM Pty Ltd
> X-Accept-Language: en
>
> I am trying to build a powerpc-linux cross-compiler from
> binutils-2.9.5.0.24, gcc-2.95.2 and glibc-2.1.2 sources. I first want
> to compile and install the native compiler from the above sources. I
> have --prefix=/usr/local/gcc. The binutils, gcc and glibc compile went
> fine. I can no longer compile simple test program after I install the
> glibc files. I have tracked this down to the linker getting
> ld-linux.so.2 from /lib instead of /usr/local/gcc/lib. I have changed
> all the search paths in the linker scripts
> (/usr/local/gcc/i586-pc-linux-gnu/lib/ldscripts/*) but I still have the
> same problem. Using the --verbose option with ld, I can see it is using
> a "built in" linker script which has /lib in its search path. I can get
> the program to compile and run only if I use
> "-Wl,-rpath,/usr/local/gcc/lib".
You wish to build a cross-compiler, which is running on an i586 Linux
host, and which will compile executables which will be run on a
powerpc Linux target?
If so, you shouldn't be configuring glibc with --prefix=/usr/local at
all, unless the powerpc Linux machine has glibc configured the same
way. You almost certainly want to configure it with --prefix=/usr.
In fact, you want to get the real glibc binaries that will be running
on the target machine and use that.
However, you don't install it in /usr (unless you want to make your
i586 system unusable!). You configure gcc and binutils with, for
instance, --prefix=/usr/local, have glibc install into say
/tmp/glibc-root, (but not changing the prefix!) and then copy from
/tmp/glibc-root/usr/include into
/usr/local/powerpc-unknown-linux-gnu/sys-include and from
/tmp/glibc-root/lib and /tmp/glibc-root/usr/lib into
/usr/local/powerpc-unknown-linux-gnu/lib.
The stuff in /usr/local/gcc/i586-pc-linux-gnu is for native tools on
i586 linux and is not used by the cross-compiler. On my
cross-compiling installation (from powerpc-aix to powerpc-linux), the
.x file, in
/usr/clocal/powerpc-unknown-linux-gnu/lib/ldscripts/elf32ppc.x, seems
to have an appropriate path in it:
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
"elf32-powerpc")
OUTPUT_ARCH(powerpc)
ENTRY(_start)
SEARCH_DIR(/usr/clocal/powerpc-unknown-linux-gnu/lib);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
PROVIDE (__stack = 0);
...
although you should be aware that it's also compiled into ld, so
changing it doesn't necessarily work.
> I can't see anything in the specs file either. Only the
> --dynamic-linker option. I have actually changed this to
> /usr/local/gcc/lib/ld-linux.so.2.
This certainly won't work. On ppc linux the dynamic linker is
/lib/ld.so.1.
--
- Geoffrey Keating <geoffk@cygnus.com>