This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: --with-sysroot newbie troubles: "ld: cannot open crt1.o"
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 13 Jan 2004 16:19:23 -0500
- Subject: Re: --with-sysroot newbie troubles: "ld: cannot open crt1.o"
- References: <40045CDB.702@kegel.com>
On Tue, Jan 13, 2004 at 01:02:19PM -0800, Daniel Kegel wrote:
> Daniel Jacobowitz wrote:
> >On Mon, Jan 12, 2004 at 05:37:15PM -0800, Daniel Kegel wrote:
> >>The following seem to be important when building a sysroot'd gcc/glibc
> >>x86 -> x86_64 cross toolchain:
> >>
> >>1. you must configure glibc with --prefix=/usr; there seem to be several
> >>things that rely on this as a special case.
> >
> >In fact, you must almost always configure glibc in this fashion.
> >Otherwise the /lib - /usr/lib split does not happen.
>
> I had been happily compiling without that split for many moons...
> this is the first time I've run into a situation where
> something doesn't work without it.
Well, compiling works. Runtime gets a little strange if you want a
standard LSB/FHS compatible layout.
> >>2. $sysroot/lib/ must exist before building the final gcc, even though it
> >>is not used, because $sysroot/lib64 is reached via $sysroot/lib/../lib64
> >>
> >>I did those, and I now have a toolchain that can compile hello, world.
> >
> >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.
>
> Oh, it can't be that hard to canonicalize paths before using them, can it?
In fact it's impossible in the general case, and expensive otherwise.
Think symlinks.
> But no matter, it's easy enough to do "mkdir $sysroot/lib" before building.
>
> By the way, what's the reasoning for the following hunk (first posted in
> http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00405.html
> but now part of gcc-3.3.3-pre)?
>
> --- gcc-3.3.1.hj/gcc/configure.in 2003-11-06 15:35:07.000000000 -0500
> +++ gcc-3.3.1.drow/gcc/configure.in 2003-11-06 15:34:23.000000000 -0500
> @@ -2430,7 +2431,7 @@ case "$target" in
> ;;
> esac
>
> -if test x$with_sysroot = x && x$host = x$target \
> +if test x$with_sysroot = x && test x$host = x$target \
> && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ;
> then
> AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
> fi
Without it is a syntax error? :) It's the same syntax error I _always_
make when writing shell scripts. x$host gets interpreted as a command.
> I had been using something like --with-local-prefix=$sysroot/usr when
> building the
> bootstrap gcc so it could find pthread.h when building the final gcc.
> With this hunk, that no longer works. I guess that's ok -- I can
> switch to --with-sysroot for gcc-3.3.3 and later -- but it sure was
> confusing until I noticed the change.
The general idea is that $prefix/include for a sysrooted toolchain
contains things like bfd.h for the cross binutils. The headers are in
$prefix/$target/include or $sysroot/usr/include. If you use
--with-sysroot then usr/include should get searched automatically, no
hoops jumped through.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer