我在Solaris 10 SPARC中编译的GNU GCC 9不工作

我在Solaris 10 SPARC中编译的GNU GCC 9不工作,gcc,makefile,solaris,gnu,sparc,Gcc,Makefile,Solaris,Gnu,Sparc,我已经在我的Sun/Oracle SPARC服务器上成功地将GNU GCC-9.1.0编译成Solaris 10 SPARC edition操作系统。 但是,我不得不将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”

我已经在我的Sun/Oracle SPARC服务器上成功地将GNU GCC-9.1.0编译成Solaris 10 SPARC edition操作系统。 但是,我不得不将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编译器不工作,有关详细信息,请参阅config.log文件”。我已将生成的相关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位于)

cc1
(编译器正确的可执行文件)取决于动态
libmpc.so.3

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

LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH ldd `gcc --print-file-name cc1`  
如果第二次输出中没有“未找到”消息,则可以使用
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
为所有涉及调用
gcc
(例如
/configure
gmake
的命令加前缀。或者,您可以
导出LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
,但这仍然只适用于当前shell会话。要使更改永久化,您可以将export命令添加到您的配置文件中(例如,bash的
~/.bashrc
文件,我不知道您使用的是什么shell)


GCC有一个记录
——以及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).

它提到一个名为
libmpc.so.3
的静态库文件没有任何意义
libmpc.so.3应该是一个共享对象,而不是一个“静态库”。啊,是的。我的错误。谢谢安德鲁:)你写的命令不起作用。我得到以下输出是'('unexpected@greenelephant我猜,您的shell不支持此命令替换语法。backtick表单是标准的,请尝试它(我现在将编辑答案)。抱歉,vladislav我不知道您提到“backtick表单”时的意思我仍然是n00b:(@greenelephant这是shell中使用backticks的命令替换语法:
`command`
。如果我正确地解释了您的第一条注释,那么还有另一种语法:
$(command)
,您的shell无法识别它。答案中的命令(我已更新)现在对您有效吗?
'--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).