Bootstrap failure on trunk on linux? (libgmp.so.3 exists, but not found)

2006-11-04 Thread Brooks Moses
I've been setting up a Debian box to do builds on, and make bootstrap on 
mainline is failing somewhere in the middle of Stage 1.  The problem 
appears to be that it's not looking in the right places for libgmp.so.3 
when it calls ./gcc/xgcc at the end of the stage.


-

The box, for what it's worth, is an out-of-the-box Debian Stable, with 
the latest GMP and fully-patched MPFR built by hand and installed in 
/usr/local/lib:


~/build-trunk ls /usr/local/lib
firmware  libgmp.a  libgmp.la  libgmp.so  libgmp.so.3  libgmp.so.3.4.1 
libmpfr.a  libmpfr.la


I used the following configure line:

~/build-trunk ../svn-source/configure --verbose 
--prefix=/home/brooks/gcc-trunk --enable-languages=c,c++,fortran 
--with-gmp=/usr/local --with-mpfr=/usr/local


This appears to work quite well for a while; configure finds the mpfr 
and gmp libraries, and is quite happy with them.  However, a good ways 
into the build, it fails on the following error (with a few messages 
quoted before that for context):


gcc -c   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute 
-fno-common   -DHAVE_CONFIG_H -I. -I. -I../../svn-source/gcc 
-I../../svn-source/gcc/. -I../../svn-source/gcc/../include 
-I../../svn-source/gcc/../libcpp/include -I/usr/local/include 
-I/usr/local/include -I../../svn-source/gcc/../libdecnumber 
-I../libdecnumber../../svn-source/gcc/cppspec.c -o cppspec.o
gcc   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings 
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute 
-fno-common   -DHAVE_CONFIG_H  -o cpp gcc.o opts-common.o gcc-options.o 
cppspec.o \
  intl.o prefix.o version.o driver-i386.o  ../libcpp/libcpp.a 
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib 
-L/usr/local/lib -lmpfr -lgmp
/home/brooks/build-trunk/./gcc/xgcc -B/home/brooks/build-trunk/./gcc/ 
-B/home/brooks/gcc-trunk/i686-pc-linux-gnu/bin/ 
-B/home/brooks/gcc-trunk/i686-pc-linux-gnu/lib/ -isystem 
/home/brooks/gcc-trunk/i686-pc-linux-gnu/include -isystem 
/home/brooks/gcc-trunk/i686-pc-linux-gnu/sys-include -dumpspecs  tmp-specs
/home/brooks/build-trunk/./gcc/xgcc: error while loading shared 
libraries: libgmp.so.3: cannot open shared object file: No such file or 
directory

make[3]: *** [specs] Error 127
make[3]: Leaving directory `/home/brooks/build-trunk/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/brooks/build-trunk'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/brooks/build-trunk'
make: *** [bootstrap] Error 2

I'm not really sure what to make of this; libgmp.so.3 most certainly 
exists in the specified directory, configure had no problem finding the 
relevant files, and the line immediately before the one that fails has a 
-lgmp -lmpfr on it that works fine.


However, there's a workaround: if I copy libgmp.so.3 into /lib, then the 
build works.  (Or, at least, it gets to Stage 2; it's still going)


It shouldn't be doing that, yes?

- Brooks



Re: Bootstrap failure on trunk on linux? (libgmp.so.3 exists, but not found)

2006-11-04 Thread Daniel Jacobowitz
On Sat, Nov 04, 2006 at 10:57:14AM -0800, Brooks Moses wrote:
 I've been setting up a Debian box to do builds on, and make bootstrap on 
 mainline is failing somewhere in the middle of Stage 1.  The problem 
 appears to be that it's not looking in the right places for libgmp.so.3 
 when it calls ./gcc/xgcc at the end of the stage.

It's doing exactly what it ought to, though unintuitive.  If you tell a
-compiler to use L/usr/local/lib, you're responsible for also setting
up either an rpath or LD_LIBRARY_PATH to point at /usr/local/lib; doing
it by default causes all kinds of problems.

-- 
Daniel Jacobowitz
CodeSourcery


Re: Bootstrap failure on trunk on linux? (libgmp.so.3 exists, but not found)

2006-11-04 Thread Brooks Moses

Daniel Jacobowitz wrote:

On Sat, Nov 04, 2006 at 10:57:14AM -0800, Brooks Moses wrote:
I've been setting up a Debian box to do builds on, and make bootstrap on 
mainline is failing somewhere in the middle of Stage 1.  The problem 
appears to be that it's not looking in the right places for libgmp.so.3 
when it calls ./gcc/xgcc at the end of the stage.


It's doing exactly what it ought to, though unintuitive.  If you tell a
-compiler to use L/usr/local/lib, you're responsible for also setting
up either an rpath or LD_LIBRARY_PATH to point at /usr/local/lib; doing
it by default causes all kinds of problems.


Ah, okay.  Thanks for the quick reply!

I guess I was assuming that since GMP is supposedly only a prerequisite 
for building the compiler and not for using it, that it was being linked 
in statically rather than dynamically.  But I guess that wouldn't apply 
to xgcc, since it's only used in the build (right?).


- Brooks



Re: Bootstrap failure on trunk on linux? (libgmp.so.3 exists, but not found)

2006-11-04 Thread H. J. Lu
On Sat, Nov 04, 2006 at 04:58:42PM -0800, Brooks Moses wrote:
 Daniel Jacobowitz wrote:
 On Sat, Nov 04, 2006 at 10:57:14AM -0800, Brooks Moses wrote:
 I've been setting up a Debian box to do builds on, and make bootstrap on 
 mainline is failing somewhere in the middle of Stage 1.  The problem 
 appears to be that it's not looking in the right places for libgmp.so.3 
 when it calls ./gcc/xgcc at the end of the stage.
 
 It's doing exactly what it ought to, though unintuitive.  If you tell a
 -compiler to use L/usr/local/lib, you're responsible for also setting
 up either an rpath or LD_LIBRARY_PATH to point at /usr/local/lib; doing
 it by default causes all kinds of problems.
 
 Ah, okay.  Thanks for the quick reply!
 
 I guess I was assuming that since GMP is supposedly only a prerequisite 
 for building the compiler and not for using it, that it was being linked 
 in statically rather than dynamically.  But I guess that wouldn't apply 
 to xgcc, since it's only used in the build (right?).
 

I have been using this patch to make sure that GMPLIBS is linked
statically so that I can install gcc binaries on machines without
updated GMPLIBS.


H.J.

--- gcc/Makefile.in.gmp 2006-05-19 06:23:09.0 -0700
+++ gcc/Makefile.in 2006-05-19 13:20:17.0 -0700
@@ -295,7 +295,7 @@ ZLIB = @zlibdir@ -lz
 ZLIBINC = @zlibinc@
 
 # How to find GMP
-GMPLIBS = @GMPLIBS@
+GMPLIBS = -Wl,-Bstatic @GMPLIBS@ -Wl,-Bdynamic
 GMPINC = @GMPINC@
 
 CPPLIB = ../libcpp/libcpp.a


Re: Bootstrap failure on trunk on linux? (libgmp.so.3 exists, but not found)

2006-11-04 Thread Daniel Jacobowitz
On Sat, Nov 04, 2006 at 04:58:42PM -0800, Brooks Moses wrote:
 I guess I was assuming that since GMP is supposedly only a prerequisite 
 for building the compiler and not for using it, that it was being linked 
 in statically rather than dynamically.  But I guess that wouldn't apply 
 to xgcc, since it's only used in the build (right?).

No, xgcc is installed as gcc.  If you have a dynamic libgmp, it will be
used.

-- 
Daniel Jacobowitz
CodeSourcery