This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: linker search directories


Thanks for your help and suggestions Geoff.  They are very useful.
My main problem was with the newly compiled native i586 tools.
I fixed the linking probem by adding %{!rpath:-rpath /usr/local/gcc/lib} in
the specs file.

Geoff Keating wrote:

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

Yes.  But first I wanted to compile the tools on my native i586-linux machine
before building the cross-compile tools.
The problems I mentioned were related to native compiles.  Sorry if I threw
you off track.


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

OK.  This seems to make sense.


> 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

Sorry about the confusion.  I was asking about native compiler.


> although you should be aware that it's also compiled into ld, so
> changing it doesn't necessarily work.

Yep.  I think I was caught by this one.


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

Correct.  The i586-linux dynamic linker is ld-linux.so.2.

Thanks for help,
Brendan Simon.



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]