首页 文章

构建GCC 4.6 - libmpfr.so.4 - 无法打开共享对象文件

提问于
浏览
5

我正在尝试在CentOS 5.5版(最终版)下构建GCC 4.6 . 我刚刚构建了GMP-5.0.1,MPC-0.9和MPFR-3.0.1,并使用了以下configure命令:

../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

在此之后,我运行make并在大约5分钟后得到以下错误消息:

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.

config.log表示涉及最近生成的程序(cc1):

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

事实上,如果我在没有参数的情况下运行此程序,我会在config.log中找到相同的错误消息:

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

但是,libmpfr.so.4位于提供的lib子目录中,使用--with-mpfr标志进行配置,如上所示 . 我有LD_LIBRARY_PATH和LIBRARY_PATH为空 . 知道如何通过这个错误吗?

3 回答

  • 3

    确保您的库在给定的目录中是实际的,而不是在某些 lib 子目录中 . 正如您所建议的那样使用 export LD_LIBRARY_PATH=/users/xxxx/code/gcc/mpfr-3.0.1-install-cyprus ;-)

  • 5

    我知道这个帖子已经过时了 . 但是,我不得不发表评论并说,在一个非常类似的问题上敲打我的头撞了5个小时后(检查目标文件的后缀...配置:错误:无法计算目标文件的后缀:无法编译)和拥有阅读安装手册,众多论坛,并在有问题的系统上尝试各种各样的事情,我发现这个简短但非常有用的帖子 . 该问题与LD_LIBRARY_PATH正好相关 . 简而言之,当你从源码构建时,如果你点击这个墙,则导出LD_LIBRARY_PATH变量以指向libs的源构建目录 . 无论如何,为我工作 .

    祝你好运 .

  • 0

    我知道这个帖子已经过时了 . 我在WSL上安装mpfr时遇到了类似的问题 . 构建很好并且正确安装了mpfr但是当我写了一个小的C文件以查看我是否可以访问头文件并打印安装版本时 - 我可以编译C文件但是当我尝试运行编译对象时 - 它会给我一个错误 . C文件是,

    #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;
    }
    

    我正在编译这个,

    gcc -o version mpfr_presence.c -lmpfr -lgmp
    

    但是当我尝试使用 ./version 运行时,我会收到以下错误,

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

    我使用了解决了这个错误,

    sudo apt-get update
    sudo apt-get install libmpfr4
    

    然后当它说 libmpfr4 已经是最新版本时,只是为了确定,

    sudo apt-get install --reinstall libmpfr4
    

    现在 ./version 给了我,

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

相关问题