简体   繁体   中英

My compiled GNU GCC 9 in Solaris 10 SPARC is not working

I have successfully compiled GNU GCC-9.1.0 successfully into Solaris 10 SPARC edition OS on my Sun/Oracle SPARC server. I have had to however copy the static library files of libgmp.so, libmfr.so and libmpc.so into the following directories created during the 'gmake' process gcc-9.1.0/host-sparc-sun-solaris2.10/gcc gcc-9.1.0/host-sparc-sun-solaris2.10/prev-gcc

I now have a problem when I try to configure using the './configure' command any tarball archive containing C code source files. When I type in './configure' I get an error message saying 'C Compiler does not work, see config.log file for details' . I have uploaded the relevant config.log file generated into the following URL. It mentions that a static library file named 'libmpc.so.3 is missing, however the library file is present within /usr/local/lib directory. How do I resolve this situation. I shall appreciate any help given to me

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

(full config.log is at http://tab140.freewebspace.com/config-gcc9.txt )

cc1 (the compiler proper executable) depends on the dynamic libmpc.so.3 library.

See

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

It should show you that mpc and other libraries are not found. This is because /usr/local/lib is not on your runtime shared library path, and you are responsible for making sure it is. One option is to temporarily put it there: try

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

If "not found" messages are gone in the second output, you can prefix all your commands involving invocations of gcc (such as ./configure , gmake , etc.) with LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH . Alternatively, you can export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH , but that still will work only for the current shell session. To make the changes permanent you can add the export command to your profile (eg ~/.bashrc file for bash, I don't know what shell you are using).


GCC has an installation manual that documents the --with-mpc-lib option among others:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM