【问题标题】:My compiled GNU GCC 9 in Solaris 10 SPARC is not working我在 Solaris 10 SPARC 中编译的 GNU GCC 9 不工作
【发布时间】:2019-11-06 05:37:20
【问题描述】:

我已成功地将 GNU GCC-9.1.0 编译到我的 Sun/Oracle SPARC 服务器上的 Solaris 10 SPARC 版操作系统中。 但是,我不得不将 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 代码源文件的 tarball 存档时,我现在遇到了问题。当我输入 './configure' 时,我收到一条错误消息,提示 'C Compiler does not work, see config.log file for details'。我已将生成的相关 config.log 文件上传到以下 URL。它提到一个名为“libmpc.so.3”的静态库文件丢失,但是该库文件存在于 /usr/local/lib 目录中。我该如何解决这种情况。我会感谢任何给予我的帮助

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

【问题讨论】:

  • 它提到了一个名为libmpc.so.3的静态库文件这没有意义。 libmpc.so.3 应该是一个共享对象,而不是一个“静态库”。
  • 啊,是的。我的错。谢谢安德鲁 :)

标签: gcc makefile solaris gnu sparc


【解决方案1】:

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

ldd `gcc --print-file-name cc1`

它应该告诉你没有找到 mpc 和其他库。这是因为/usr/local/lib 不在您的运行时共享库​​路径上,您有责任确保它在。 一种选择是暂时把它放在那里:试试

LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH ldd `gcc --print-file-name cc1`  

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


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

'--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).

【讨论】:

  • 您编写的命令不起作用。我得到以下输出
  • 输出是 '(' 出乎意料
  • @greenelephant 我猜,你的 shell 不支持这个命令替换语法。反引号形式是标准的,试试吧(我现在要编辑答案)。
  • 对不起,弗拉迪斯拉夫,当你提到“反引号”时,我不明白你的意思我仍然是一个 n00b :(
  • @greenelephant 这是 shell 中使用反引号的命令替换语法:`command`。同样的事情还有另一种语法:$(command),如果我正确解释了您的第一条评论,您的外壳无法识别。答案中的命令(我已更新)现在对您有用吗?
猜你喜欢
  • 2019-10-30
  • 1970-01-01
  • 2019-11-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-08
  • 2012-12-24
相关资源
最近更新 更多