首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >我在Solaris 10 SPARC中编译的GNU GCC 9无法正常工作

我在Solaris 10 SPARC中编译的GNU GCC 9无法正常工作
EN

Stack Overflow用户
提问于 2019-06-24 20:01:39
回答 1查看 556关注 0票数 1

我已经在Sun/Oracle SPARC服务器上成功地将GNU GCC-9.1.0编译成Solaris10SPARC版操作系统。但是,我必须将libgmp.so、libmfr.so和libmpc.so的静态库文件复制到'gmake‘过程中创建的以下目录中: gcc-9.1.0/host-sparc-sun-solaris2.10/gcc gcc-9.1.0/host-sparc-sun-Solaris2.10/prev gcc

当我输入'./configure‘时,我得到一条错误消息,告诉我'C编译器不工作,有关详细信息,请参阅config.log文件’。我已经将生成的相关config.log文件上传到以下网址。它提到缺少一个名为'libmpc.so.3‘的静态库文件,但是这个库文件存在于/usr/local/lib目录中。

代码语言:javascript
复制
configure:2912: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sparc-sun-solaris2.10/9.1.0/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with: ./configure --enable-obsolete --with-gmp-lib=/usr/local/lib --with-mpfr-lib=/usr/local/lib --with-mpc-lib=/usr/local/lib
...[snip]...
configure:2975: gcc    conftest.c  >&5
ld.so.1: cc1: fatal: libmpc.so.3: open failed: No such file or directory
gcc: fatal error: Killed signal terminated program cc1
compilation terminated.
configure:2978: $? = 1
configure:3016: result: 
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3023: error: C compiler cannot create executables

(完整的config.log请访问http://tab140.freewebspace.com/config-gcc9.txt)

EN

回答 1

Stack Overflow用户

发布于 2019-06-24 22:24:13

cc1 (编译器正确的可执行文件)依赖于动态libmpc.so.3库。

看见

代码语言:javascript
复制
ldd `gcc --print-file-name cc1`

它应该会向您显示未找到mpc和其他库。这是因为/usr/local/lib不在您的运行时共享库路径上,您有责任确保它在运行时共享库路径上。一种选择是暂时将其放在那里:

代码语言:javascript
复制
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH ldd `gcc --print-file-name cc1`  

如果第二个输出中没有"not found“消息,那么可以在涉及gcc调用的所有命令(如./configuregmake等)前加上前缀。和LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH在一起。或者,您也可以使用export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH,但这仍然只适用于当前的shell会话。要使更改永久生效,您可以将导出命令添加到您的配置文件中(例如,bash的~/.bashrc文件,我不知道您使用的是什么外壳)。

GCC有一个installation manual,其中记录了--with-mpc-lib选项:

代码语言:javascript
复制
'--with-gmp=PATHNAME'
'--with-gmp-include=PATHNAME'
'--with-gmp-lib=PATHNAME'
'--with-mpfr=PATHNAME'
'--with-mpfr-include=PATHNAME'
'--with-mpfr-lib=PATHNAME'
'--with-mpc=PATHNAME'
'--with-mpc-include=PATHNAME'
'--with-mpc-lib=PATHNAME'
     If you want to build GCC but do not have the GMP library, the MPFR
     library and/or the MPC library installed in a standard location and
     do not have their sources present in the GCC source tree then you
     can explicitly specify the directory where they are installed
     ('--with-gmp=GMPINSTALLDIR', '--with-mpfr=MPFRINSTALLDIR',
     '--with-mpc=MPCINSTALLDIR').  The '--with-gmp=GMPINSTALLDIR' option
     is shorthand for '--with-gmp-lib=GMPINSTALLDIR/lib' and
     '--with-gmp-include=GMPINSTALLDIR/include'.  Likewise the
     '--with-mpfr=MPFRINSTALLDIR' option is shorthand for
     '--with-mpfr-lib=MPFRINSTALLDIR/lib' and
     '--with-mpfr-include=MPFRINSTALLDIR/include', also the
     '--with-mpc=MPCINSTALLDIR' option is shorthand for
     '--with-mpc-lib=MPCINSTALLDIR/lib' and
     '--with-mpc-include=MPCINSTALLDIR/include'.  If these shorthand
     assumptions are not correct, you can use the explicit include and
     lib options directly.  You might also need to ensure the shared
     libraries can be found by the dynamic linker when building and
     using GCC, for example by setting the runtime shared library path
     variable ('LD_LIBRARY_PATH' on GNU/Linux and Solaris systems).
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56736124

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档