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 Kegel <dank at kegel dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 13 Jan 2004 13:02:19 -0800
- Subject: Re: --with-sysroot newbie troubles: "ld: cannot open crt1.o"
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.
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?
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
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.
- Dan