This is the mail archive of the
mailing list for the GCC project.
Re: --with-sysroot newbie troubles: "ld: cannot open crt1.o"
On Mon, Jan 12, 2004 at 10:26:00PM -0500, Daniel Jacobowitz wrote:
> Ah sorry, these are lib64-specific problems so I wasn't as familiar
> with them. I encountered the latter recently on MIPS64. I tried to
> fix GCC to make it go away, and it turned out to be... shall we say...
> bloody hard.
Off the top of my head, there are two extremely annoying problems
with multi-lib biarch ports. This isn't specific to sysroot, in fact
sysroot helps to some extent.
1) biarch changes the meaning of $tooldir/lib. By $tooldir/lib, I'm
referring to $prefix/$machine/lib, eg. for --prefix=/usr/local
--target=powerpc64-linux, this is /usr/local/powerpc64-linux/lib.
This dir used to be searched for ppc64 libs and crt files. Now, with
biarch, this dir is searched for ppc32 libs and crt files, and
/usr/local/powerpc64-linux/lib64 is for ppc64. You must move files
around if you have some in these dirs. This is a pain to say the
least. Bad luck if you want to use an older non-biarch compiler with
the same prefix..
2) multilib search paths miss some dirs. Concentrating on a cross-
compiler setup again for the same prefix and machine, if I compile
with -m32 -msoft-float, then gcc searches in
/usr/local/powerpc64-linux/lib/nof/ for crt files, but not in
/usr/local/powerpc64-linux/lib/, which is the -m32 dir. There's
a perfectly good set of crt files in this dir for -msoft-float.
Using sysroot helps with (1), because then cross-compilers don't need to
use $tooldir at all. Various hacks allow you to get around (2), from
the obvious one of duplicating files in the two dirs, to fiddling
The best solution I have to (1) is to change the biarch compiler
search path to $tooldir/lib64 for -m64 and $tooldir/lib32 for -m32.
(Change rs6000/t-linux64 MULTILIB_OSDIRNAMES = ../lib64 ../lib32 nof)
Then make symbolic links from $tooldir/lib64 and $tooldir/lib32 to
where the files really are, eg. to /usr/local/powerpc64-linux/lib and
/usr/local/powerpc-linux/lib, the same places as older compilers
search. For native builds you also need to make symbolic links from
/usr/lib32 to /usr/lib and /lib32 to /lib.
IBM OzLabs - Linux Technology Centre