I am having a remarkable amount of trouble building gcc 4.5 on Linux (Red Hat Enterprise 4). For good measure, I also tried on my mac running Leopard.
I would love to just install an rpm, but the Red hat version we are running is old enough that no one has rpms for it. So I thought I would build off source, no problem, right?
First, /opt/tools was created for me, so I could write the results in there without being sysadmin
gcc 4.5 now requires three packages: GMP, MPFR, and MPC, all math primitives.
I successfully built all three wth:
./configure --prefix=/opt/tools make make install (for GMP I also did make check)
For MPFR and MPC, configuration was slightly different:
./configure --prefix=/opt/tools --with-gmp=/opt/tools
So I have gmp-5.0.1, mpfr-3.0.0, mpc-0.8.2
gcc instructions are more complicated, because it bootstraps itself. The compiler that I have on the system is 3.4.6.
In my directory with all the packages, I first create a directory to build into: mkdir gcc451 cd gcc451 Then from inside the empty directory, I call configure in the gcc directory:
../gcc-4.5.1/configure --prefix=/opt/tools --with-gmp=/opt/tools --with-mpfr=/opt/tools --with-mpc=/opt/tools
On the mac, I also had to add target directives, I am a little hazy as to why, but something is messed up in the configuration evidently
--build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 --target=x86_64-apple-darwin10
On the mac, configure reports: checking for the correct version of gmp.h... yes checking for the correct version of mpfr.h... yes checking for the correct version of mpc.h... yes checking for the correct version of the gmp/mpfr/mpc libraries... no configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
I export DYLD_LIBRARY_PATH=/opt/lib still, it doesn't find those libraries, but they are there:
libgmp.10.dylib libgmp.la libmpc.dylib libmpfr.a libgmp.a libmpc.2.dylib libmpc.la libmpfr.dylib libgmp.dylib libmpc.a libmpfr.4.dylib libmpfr.la
On the Linux box, I somehow got it to recognize the libs in /opt/tools, and ./configure was successful. I am not there now, but will append the details later at work. However, after compiling, the code is unable to find libgmp, even though it's built, and export LD_LIBRARY_PATH=/opt/tools/lib containing all three libraries. So the problem is similar even though there, configure reports no problems.
I'm not surprised that there's a little difficulty on the Mac, but I was startled at how hard this was on Linux. I remembered about the multi-pass build, but still there is no hardware dependency, no odd drivers to contend with....
asked 04 Aug '10, 11:16
Like Jeremy said, if you can post some output, and snippets from the config.log file in the gcc-4.5.1 directory (or just post the whole file), we would all have a better idea as to how to help you out.
answered 13 Aug '10, 20:57
If you happen to have a "/etc/ld.so.conf.d" folder (I have it on my ubuntu 10.04 box, not sure if red hat has it), you'll see that there are a few *.conf files containing the names of directories like "/usr/local/lib",etc., if you have sudo (or the necessary permissions), you can create a file, e.g, "location_of_lib.conf" and write the name of the folder containing your compiled libs, e.g, "/home/my/sweet/apps/libs", without double quotes. After doing that, run the command "ldconfig".
In principle, the steps above will tell your linux box to load the necessary libs at the location you specified in the conf file, thus, everytime you call the compiler, it will find everything it needs.
I hope this helps, if not, best of luck!
answered 05 Dec '10, 00:37
Instead of making each separately and then telling configure where they are, try building GCC with gcc451/mpfr, gcc451/gmp, gcc451/mpc inside the source directory. The configure script will see directories and build them correctly.
This is how the contrib/download_prerequisites script handles things (in 4.6 and 4.7):
Might want to see the (new in 4.7) GCC wiki as well:
answered 22 Feb '12, 09:46
I am having a remarkable amount of trouble building gcc 4.5 on Linux (Red Hat Enterprise 4). For good measure, I also tried on my mac ...
Want to get-on Google's first page and loads of traffic to your website? Hire a SEO Specialist from Ocean Groups [url=http://oceangroups.org/] seo pecialist [/url]
answered 13 Aug '10, 06:53