Bug 45760 - GCC build fails: can't find MPC
Summary: GCC build fails: can't find MPC
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.5.1
: P3 normal
Target Milestone: ---
Assignee: Jonathan Wakely
URL:
Keywords: documentation
Depends on:
Blocks:
 
Reported: 2010-09-23 13:06 UTC by Avi Alkalay
Modified: 2010-09-30 18:39 UTC (History)
1 user (show)

See Also:
Host: powerpc64-linux
Target: powerpc64-linux
Build: powerpc64-linux
Known to work:
Known to fail:
Last reconfirmed: 2010-09-23 15:28:27


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Avi Alkalay 2010-09-23 13:06:57 UTC
I believe this is a bug in GCC 4.5.1 build system related to the introduction of MPC.

I'm compiling GCC 4.5.1 and all its dependencies in my home directory and installing all (make install) at $HOME/OpenFOAM/ROOT

At some GCC build stage it fails with this messages:

---------------------------------------
checking for powerpc64-unknown-linux-gnu-strip... strip
checking whether ln -s works... yes
checking for powerpc64-unknown-linux-gnu-gcc... /bgpusr3/avibrz/OpenFOAM/gcc-build/./gcc/xgcc -B/bgpusr3/avibrz/OpenFOAM/gcc-build/./gcc/ -B/bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/bin/ -B/bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/lib/ -isystem /bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/include -isystem /bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/bgpusr3/avibrz/OpenFOAM/gcc-build/powerpc64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/bgpusr3/avibrz/OpenFOAM/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/bgpusr3/avibrz/OpenFOAM/gcc-build'
make: *** [all] Error 2
---------------------------------------

Side note: /bgpusr3/avibrz == $HOME
Having a look at /bgpusr3/avibrz/OpenFOAM/gcc-build/powerpc64-unknown-linux-gnu/libgcc/config.log I find this:

---------------------------------------
configure:3211: checking for suffix of object files
configure:3233: /bgpusr3/avibrz/OpenFOAM/gcc-build/./gcc/xgcc -B/bgpusr3/avibrz/OpenFOAM/gcc-build/./gcc/ -B/bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/bin/ -B/bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/lib/ -isystem /bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/include -isystem /bgpusr3/avibrz/OpenFOAM/ROOT/powerpc64-unknown-linux-gnu/sys-include    -c -g -O2  conftest.c >&5
/bgpusr3/avibrz/OpenFOAM/gcc-build/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
configure:3237: $? = 1
---------------------------------------

But libmpc.so.2 is there. I even took care of creating artificial symbolic links to satisfy this bizarre 'powerpc64-unknown-linux-gnu' under ROOT.

This is how I'm configuring GCC as I took care of passing correct directories for MPC installation:

---------------------------------------
gcc-build$ ../gcc-4.5.1/configure --prefix=$HOME/OpenFOAM/ROOT --with-stage1-ldflags="-L$HOME/OpenFOAM/ROOT/lib" --with-gmp="$HOME/OpenFOAM/ROOT" --with-mpfr="$HOME/OpenFOAM/ROOT" --with-ppl="$HOME/OpenFOAM/ROOT" --with-mpc="$HOME/OpenFOAM/ROOT" --enable-languages=c++,fortran
---------------------------------------

Any tip ?
Comment 1 Jonathan Wakely 2010-09-23 13:58:07 UTC
set LD_LIBRARY_PATH so the dynamic loader can find libmpc.so.2
Comment 2 Avi Alkalay 2010-09-23 14:03:57 UTC
I was able to make it pass that stage explicitly setting the library path like this:

gcc-build$ LD_LIBRARY_PATH=$HOME/OpenFOAM/lib make

I found this was not related to MPC since I moved to 4.4.4 (pre-MPC version of GCC) and I got same problem with MPFR (another GCC dependency).

Since I'm already using --with-mpfr=DIRNAME, I was expecting that the library path was being set automatically.

So I still consider this a weak point on the build system that could be automatically managed.
Comment 3 Jonathan Wakely 2010-09-23 14:08:18 UTC
GCC doesn't set runpaths in executables, this is intentional:
http://gcc.gnu.org/faq.html#rpath

If you don't want those support libs installed for their own sake and are only installing them for GCC to use, then a simpler way to build it is to put the gmp, mpfr and mpc sources under gcc-4.5.1 (renamed from gmp-x.y.z to just gmp, and similarly for mpfr and mpc) and then just configure gcc without any --with-{gmp,mpfr,mpc} options.  That way gcc will build with those sources and doesn't need to find the shared libs.

Or you can build the libs with --disable-shared so that gcc will have to link statically to libgmp.a, which also avoids needing to find the shared libs.

Or you can just make sure the shared lib can be found, using LD_LIBRARY_PATH or LD_RUN_PATH or ldconfig.

(In reply to comment #0)
> But libmpc.so.2 is there. I even took care of creating artificial symbolic
> links to satisfy this bizarre 'powerpc64-unknown-linux-gnu' under ROOT.

Don't do that.
Comment 4 Jonathan Wakely 2010-09-23 14:14:55 UTC
this should be documented, either under the --with-gmp configuration docs or in the faq
Comment 5 Avi Alkalay 2010-09-23 14:46:09 UTC
Jonathan, your comment #3 was very helpful. I have a very bizarre situation dealing with cross compilers and entire platforms that must run in my home directory.

Maybe the best and easier thing for my case is to statically link GCC to its dependencies.
Comment 6 Avi Alkalay 2010-09-23 14:47:18 UTC
Now I have a better understanding of GCC build system.
Comment 7 Jonathan Wakely 2010-09-23 15:28:09 UTC
I'm going to add something to the docs, so I'll keep this PR open until I do that, so reopening ...
Comment 8 Jonathan Wakely 2010-09-23 15:28:27 UTC
... and assigning to myself again
Comment 9 Jonathan Wakely 2010-09-30 18:39:44 UTC
fixed by http://gcc.gnu.org/ml/gcc-patches/2010-09/msg02135.html

the online docs should update overnight