gcc - 我在 Solaris 10 SPARC 中编译的 GNU GCC 9 不工作
问题描述
我已经成功地将 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)
解决方案
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
(例如./configure
、gmake
等)的命令前加上LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
. 或者,您可以export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
,但这仍然只适用于当前的 shell 会话。要使更改永久生效,您可以将导出命令添加到您的配置文件(例如~/.bashrc
bash 文件,我不知道您使用的是什么 shell)。
GCC 有一个安装手册,其中记录了该--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).
推荐阅读
- c# - 如何从图像opencv中去除小噪声(几个不规则的小形状)
- imagemagick - imagemagick 转换后的图像是灰色的
- machine-learning - 没有导数的梯度下降
- css - 在带有文本的元素周围添加边框
- css - 如何将此 CSS 代码仅应用于 Wordpress 上的一页?
- c++ - Linux 上的共享库和全局 std::string 问题
- ocaml - 如果两个输入列表是字谜,如何在 OCAML 中编写一个返回“true”的函数
- python - CSV 文件数据组织(结构化数据)
- java - 如果 HIbernate 使用 JDBC 本身,它究竟做了什么
- opengl-es - glDepthMask 似乎没有按预期工作?