0
votes

I've recently installed the gcc 6.1, specifically for the libraries mentioned in the title (gmp/mpfr/mpc) I followed what the gnu website said:

GNU Multiple Precision Library (GMP) version 4.3.2 (or later) Necessary to build GCC. If a GMP source distribution is found in a subdirectory of your GCC sources named gmp, it will be built together with GCC. Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include. The in-tree build is only supported with the GMP version that download_prerequisites installs.

Similar for the others libraries, namely I downloaded the sources of the last version copied in my GCC directory, before doing the "configure", "make" and "make install" of the gcc under the assumption that it would have been built together with gcc. However when I try run a compiled project that does use the gmp library it does say:

error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory

So I was looking where the shared object is, but I can't find where the GCC has installed it.

Was I supposed to firstly compile the GMP/MPFR and MPC before installing the gcc? because I thought it wasn't necessary. If I didn't need to compile the libraries where is the GMP/MPFR and MPC supposed to be installed?

Some further details:

I don't think I did anything weird and complicated I guess. 1. I downloaded gcc and placed the source in a directory. 2. I downloaded all these libraries, as tar files; 3. created three folders in the gcc sources root (gmp, mpfr and mpc) amd expanded the tars of the previous step in such folders. 4. For the gcc I executed the ./configure --prefix=/path/to/gcc_build 5. I executed the make 6. then make install

If I don't use the libraries I can compile and execute without having problems, when I need those libraries it returns the error I mentioned, after a successful compiling. If I look in the lib/ and lib64/ paths there isn't anything related to gmp libraries.

1
Maybe describe more precisely what you did? Normally, when gcc builds gmp/mpfr/mpc as part of its build, it builds only the static versions. Do you have some version of those libraries installed somewhere?Marc Glisse
@Marc Glisse See the update, and no I don't have the library installed, I assumed they would have been installed during the gcc installation.user8469759
Explain "compiled project", how do you link the library? Probably you may want to check -rpath, or try add LD_LIBRARY_PATH env when executing the project.Mine
I don't know whether it could matter or not, but if I do "locate libgmp.so.10" it doesn't return anything. Also the fact that it should be built together with the gcc shouldn't it implies that I don't need to do nothing else?user8469759
I don't really understand, in the makefile generated by "make install" there're reference to the gmp stuff, but I can understand where during "make" execution this would be installed.user8469759

1 Answers

0
votes

Correct me if I'm wrong.

I Compile GCC 6.3.0 from their source website using cygwin, after research followed this post Here first I compile the GCC infrastructures including GMP, MPFR, MPC also libelf, ppl (optional). Then try to compile GCC using this command (because I targeted GCC for linux so my target is i686-pc-linux-gnu). I compile GCC infrastructure and adding prefix to

--prefix=/opt/cross

for GMP,MPFR,MPC also libelf and ppl.

So when I compile GCC, I can using.

--with-gmp=/opt/cross --with-mpfr=/opt/cross --with-mpc=/opt/cross

and GCC will automatically followed infrastructure what they needed on /opt/cross directory.

Because many times I try to

./contrib/download_prerequisites

following this method,always getting error when try to compile GCC.

I have done with this method, compiling GCC also binutils for i686-pc-linux-gnu. But I haven't try to use for compiling linux kernel using cygwin.

Sorry for my english, and sorry if my answers is OOT.