开发者

Building GCC 4.6 - libmpfr.so.4 - cannot open shared object file

开发者 https://www.devze.com 2023-03-03 20:36 出处:网络
I\'m trying to build GCC 4.6 under CentOS release 5.5 (Final). I\'ve freshly built GMP-5.0.1, MPC-0.9, and MPFR-3.0.1, and have used the following configure command:

I'm trying to build GCC 4.6 under CentOS release 5.5 (Final). I've freshly built GMP-5.0.1, MPC-0.9, and MPFR-3.0.1, and have used the following configure command:

../configure --prefix=/users/xxxx/apps/mygcc4.6 --disable-checking --enable-threads=posix --enable-languages=c,c++,fortran --with-mpfr=/users/xxxx/code/gcc/mpfr-3.0.1-install-cyprus --with-gmp=/users/xxxx/code/gcc/gmp-5.0.1-install-cyprus --with-mpc=/users/xxxx/code/gcc/mpc-0.9-install-cyprus

After this, I run make and after about 5 minutes get the following error message:

checking for suffix of object files... configure: error: in /users/xxxx/code/gcc/gcc-4.6.0/obj/x86_64-unknown-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile Seeconfig.log' for more details.

The config.log indicates t开发者_如何学运维hat a recently generated program (cc1) is involved:

/users/xxxx/code/gcc/gcc-4.6.0/obj/./gcc/cc1

Indeed if I run this program with no arguments I get the same error message found in config.log:

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

However, libmpfr.so.4 is in the lib subdirectory of that provided to configure using the --with-mpfr flag, as seen above. I have LD_LIBRARY_PATH and LIBRARY_PATH empty. Any idea how I can get past this error?


Make sure your library is acutally in the directory given and not in some lib subdirectory. Use export LD_LIBRARY_PATH=/users/xxxx/code/gcc/mpfr-3.0.1-install-cyprus as you have already suggested ;-)


I know this thread is pretty outdated. But, I had to comment and say that after 5+ hours of banging my head against the wall on a very similar issue (checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile) and having read the install manual, a multitude of forums, and trying various things on the system in question I found this brief but very useful post. The issue was precisely related to LD_LIBRARY_PATH. Long story short, when building from source if you hit this wall export the LD_LIBRARY_PATH variable to point into the source build directory for the libs. Worked for me anyway.

Good luck folks.


I know that this thread is pretty outdated. I faced similar issues while installing mpfr on WSL. The build was fine and mpfr installed correctly but when I wrote a small C file to see if I could access the header file and print the version fo the installation - I could compile the C file but When I tried to run the compiled object - it would give me an error. The C file was,

#include <stdio.h>
#include <mpfr.h>

int main (void) {
    printf ("MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n",
    mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
    MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
    return 0;
}

I was compiling this with,

gcc -o version mpfr_presence.c -lmpfr -lgmp

But when I tried to run this with ./version, I would get the following error,

./version: error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory

I solved this error using,

sudo apt-get update
sudo apt-get install libmpfr4

And then when it said that libmpfr4 was already at its latest version, just to be sure,

sudo apt-get install --reinstall libmpfr4

Now ./version gives me,

MPFR library: 4.0.1
MPFR header: 4.0.1 (based on 4.0.1)
0

精彩评论

暂无评论...
验证码 换一张
取 消