正如标题所说,我得到的错误如“libgcc_s.so.1:版本`GCC_4.2.0'未找到”,请知道帮助的人,非常感谢。
我正在使用golang和gcc5.1.0在Sparc Solaris 10的Redhat 6.5 x86_64主机上编译一个小程序。我将库文件夹和一些其他文件夹从Solaris复制到我的Redhat主机,最后我得到了一个gccgo编译器文件他的名字是sparc-sun-solaris2.10-gccgo(在http://ggolang.blogspot.com/2015/05/gccgo-gcc510-cross-compile-for-sparc.html的帮助下)。然后我用下面的命令编译:
go build --compiler gccgo --gccgoflags "-v -static-libgo -Wl,-dy -lnsl -lsocket -lrt" aiReqResend.go
它产生一个可删除的文件(似乎工作正常):aiReqResend
但是当将可执行文件aiReqResend复制到solaris机器并运行它时,它出错了,错误信息:
t5240-1:/tank/obsnew/yinqq/lt% ./aiReqResend
ld.so.1: aiReqResend: fatal error: libgcc_s.so.1: version `GCC_4.2.0' not found(file aiReqResend essential)
ld.so.1: aiReqResend: fatal error: /tank/obsnew/lib/libgcc_s.so.1: wrong ELF type: ELFCLASS32
killed
ldd结果和Solaris机器上的gcc版本:
t5240-1:/tank/obsnew/yinqq/lt% ldd aiReqResend
libnsl.so.1 => /lib/64/libnsl.so.1
libsocket.so.1 => /lib/64/libsocket.so.1
librt.so.1 => /lib/64/librt.so.1
libpthread.so.1 => /lib/64/libpthread.so.1
libm.so.2 => /lib/64/libm.so.2
libgcc_s.so.1 => /usr/local/lib/sparcv9/libgcc_s.so.1
libgcc_s.so.1 (GCC_4.2.0) => (version not found)
libc.so.1 => /lib/64/libc.so.1
libmp.so.2 => /lib/64/libmp.so.2
libmd.so.1 => /lib/64/libmd.so.1
libscf.so.1 => /lib/64/libscf.so.1
libaio.so.1 => /lib/64/libaio.so.1
libdoor.so.1 => /lib/64/libdoor.so.1
libuutil.so.1 => /lib/64/libuutil.so.1
libgen.so.1 => /lib/64/libgen.so.1
/platform/SUNW,T5240/lib/sparcv9/libc_psr.so.1
/platform/SUNW,T5240/lib/sparcv9/libmd_psr.so.1
t5240-1:/tank/obsnew/yinqq/lt% file /usr/local/lib/sparcv9/libgcc_s.so.1
/usr/local/lib/sparcv9/libgcc_s.so.1: ELF 64-bit MSB dynamic library SPARCV9 version 1,dynamic linked,not striped
t5240-1:/tank/obsnew/yinq/shandonglt% gcc -v
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.10/3.4.6/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.6
运行gccgo编译命令的输出:
[y@M610-252126 aiReqResend]$ go build --compiler gccgo --gccgoflags "-v -static-libgo -Wl,-dy -lnsl -lsocket -lrt" aiReqResend.go
# parsing_config
Using built-in specs.
COLLECT_GCC=gccgo
Target: sparc-sun-solaris2.10
Configured with: ../gcc-5.1.0/configure --target=sparc-sun-solaris2.10 --with-gnu-as --with-gnu-ld --prefix=/home/y/opt/cross/ --with-sysroot=/home/y/opt/cross/sysroot/ --disable-libgcj --enable-languages=c,c++,go
Thread model: posix
gcc version 5.1.0 (GCC)
COLLECT_GCC_OPTIONS='-I' '/tmp/go-build137487689' '-c' '-g' '-m64' '-fgo-pkgpath=parsing_config' '-fgo-relative-import-path=_/home/y/xsd_log_resend/src/parsing_config' '-o' '/tmp/go-build137487689/parsing_config/_obj/_go_.o' '-v' '-shared-libgcc'
/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/go1 ../parsing_config/parsing_config.go -mptr64 -mstack-bias -mno-v8plus -mcpu=v9 -quiet -dumpbase parsing_config.go -m64 -auxbase-strip $WORK/parsing_config/_obj/_go_.o -g -version -fgo-pkgpath=parsing_config -fgo-relative-import-path=_/home/y/xsd_log_resend/src/parsing_config -I $WORK -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/sparcv9 -L/home/y/opt/cross/sysroot/lib/sparcv9 -L/home/y/opt/cross/sysroot/usr/lib/sparcv9 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib -L/home/y/opt/cross/sysroot/lib -L/home/y/opt/cross/sysroot/usr/lib -o /tmp/ccJntC1m.s
GNU Go (GCC) version 5.1.0 (sparc-sun-solaris2.10)
compiled by GNU C version 4.4.7 20120313 (Red Hat 4.4.7-4), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Go (GCC) version 5.1.0 (sparc-sun-solaris2.10)
compiled by GNU C version 4.4.7 20120313 (Red Hat 4.4.7-4), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-I' '/tmp/go-build137487689' '-c' '-g' '-m64' '-fgo-pkgpath=parsing_config' '-fgo-relative-import-path=_/home/y/xsd_log_resend/src/parsing_config' '-o' '/tmp/go-build137487689/parsing_config/_obj/_go_.o' '-v' '-shared-libgcc'
/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/bin/as -v -I $WORK -V -Qy -s -xarch=v9 -64 -no-undeclared-regs -o $WORK/parsing_config/_obj/_go_.o /tmp/ccJntC1m.s
GNU assembler version 2.25 (sparc-sun-solaris2.10) using BFD version (GNU Binutils) 2.25
COMPILER_PATH=/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/bin/
LIBRARY_PATH=/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/sparcv9/:/home/y/opt/cross/sysroot/lib/sparcv9/:/home/y/opt/cross/sysroot/usr/lib/sparcv9/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/:/home/y/opt/cross/sysroot/lib/:/home/y/opt/cross/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-I' '/tmp/go-build137487689' '-c' '-g' '-m64' '-fgo-pkgpath=parsing_config' '-fgo-relative-import-path=_/home/y/xsd_log_resend/src/parsing_config' '-o' '/tmp/go-build137487689/parsing_config/_obj/_go_.o' '-v' '-shared-libgcc'
# command-line-arguments
Using built-in specs.
COLLECT_GCC=gccgo
Target: sparc-sun-solaris2.10
Configured with: ../gcc-5.1.0/configure --target=sparc-sun-solaris2.10 --with-gnu-as --with-gnu-ld --prefix=/home/y/opt/cross/ --with-sysroot=/home/y/opt/cross/sysroot/ --disable-libgcj --enable-languages=c,c++,go
Thread model: posix
gcc version 5.1.0 (GCC)
COLLECT_GCC_OPTIONS='-I' '/tmp/go-build137487689' '-I' '/home/y/xsd_log_resend/pkg/gccgo_linux_amd64' '-c' '-g' '-m64' '-fgo-relative-import-path=_/home/y/xsd_log_resend/src/aiReqResend' '-o' '/tmp/go-build137487689/command-line-arguments/_obj/_go_.o' '-v' '-shared-libgcc'
/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/go1 ./aiReqResend.go -mptr64 -mstack-bias -mno-v8plus -mcpu=v9 -quiet -dumpbase aiReqResend.go -m64 -auxbase-strip $WORK/command-line-arguments/_obj/_go_.o -g -version -fgo-relative-import-path=_/home/y/xsd_log_resend/src/aiReqResend -I $WORK -I /home/y/xsd_log_resend/pkg/gccgo_linux_amd64 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/sparcv9 -L/home/y/opt/cross/sysroot/lib/sparcv9 -L/home/y/opt/cross/sysroot/usr/lib/sparcv9 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib -L/home/y/opt/cross/sysroot/lib -L/home/y/opt/cross/sysroot/usr/lib -o /tmp/ccy4Riqt.s
GNU Go (GCC) version 5.1.0 (sparc-sun-solaris2.10)
compiled by GNU C version 4.4.7 20120313 (Red Hat 4.4.7-4), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Go (GCC) version 5.1.0 (sparc-sun-solaris2.10)
compiled by GNU C version 4.4.7 20120313 (Red Hat 4.4.7-4), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-I' '/tmp/go-build137487689' '-I' '/home/y/xsd_log_resend/pkg/gccgo_linux_amd64' '-c' '-g' '-m64' '-fgo-relative-import-path=_/home/y/xsd_log_resend/src/aiReqResend' '-o' '/tmp/go-build137487689/command-line-arguments/_obj/_go_.o' '-v' '-shared-libgcc'
/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/bin/as -v -I $WORK -I /home/y/xsd_log_resend/pkg/gccgo_linux_amd64 -V -Qy -s -xarch=v9 -64 -no-undeclared-regs -o $WORK/command-line-arguments/_obj/_go_.o /tmp/ccy4Riqt.s
GNU assembler version 2.25 (sparc-sun-solaris2.10) using BFD version (GNU Binutils) 2.25
COMPILER_PATH=/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/bin/
LIBRARY_PATH=/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/sparcv9/:/home/y/opt/cross/sysroot/lib/sparcv9/:/home/y/opt/cross/sysroot/usr/lib/sparcv9/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/:/home/y/opt/cross/sysroot/lib/:/home/y/opt/cross/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-I' '/tmp/go-build137487689' '-I' '/home/y/xsd_log_resend/pkg/gccgo_linux_amd64' '-c' '-g' '-m64' '-fgo-relative-import-path=_/home/y/xsd_log_resend/src/aiReqResend' '-o' '/tmp/go-build137487689/command-line-arguments/_obj/_go_.o' '-v' '-shared-libgcc'
# command-line-arguments
Using built-in specs.
COLLECT_GCC=gccgo
COLLECT_LTO_WRAPPER=/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with: ../gcc-5.1.0/configure --target=sparc-sun-solaris2.10 --with-gnu-as --with-gnu-ld --prefix=/home/y/opt/cross/ --with-sysroot=/home/y/opt/cross/sysroot/ --disable-libgcj --enable-languages=c,c++,go
Thread model: posix
gcc version 5.1.0 (GCC)
COMPILER_PATH=/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/bin/
LIBRARY_PATH=/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/sparcv9/:/home/y/opt/cross/sysroot/lib/sparcv9/:/home/y/opt/cross/sysroot/usr/lib/sparcv9/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/:/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/:/home/y/opt/cross/sysroot/lib/:/home/y/opt/cross/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-o' 'aiReqResend' '-m64' '-v' '-shared-libgcc'
/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/collect2 -plugin /home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/liblto_plugin.so -plugin-opt=/home/y/opt/cross/libexec/gcc/sparc-sun-solaris2.10/5.1.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cccfnQ4K.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc --sysroot=/home/y/opt/cross/sysroot/ -V -m elf64_sparc_sol2 -Y P,/home/y/opt/cross/sysroot//lib/sparcv9:/home/y/opt/cross/sysroot//usr/lib/sparcv9 -Qy -o aiReqResend /home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9/crt1.o /home/y/opt/cross/sysroot/usr/lib/sparcv9/crti.o /home/y/opt/cross/sysroot/usr/lib/sparcv9/values-Xa.o /home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9/crtbegin.o -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib/sparcv9 -L/home/y/opt/cross/sysroot/lib/sparcv9 -L/home/y/opt/cross/sysroot/usr/lib/sparcv9 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0 -L/home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/../../../../sparc-sun-solaris2.10/lib -L/home/y/opt/cross/sysroot/lib -L/home/y/opt/cross/sysroot/usr/lib $WORK/command-line-arguments/_obj/_go_.o -( $WORK/libparsing_config.a -E -) -dy -lnsl -lsocket -lrt -lgobegin -Bstatic -lgo -Bdynamic -lpthread -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc -lc /home/y/opt/cross/lib/gcc/sparc-sun-solaris2.10/5.1.0/sparcv9/crtend.o /home/y/opt/cross/sysroot/usr/lib/sparcv9/crtn.o
GNU ld (GNU Binutils) 2.25
Supported emulations:
elf32_sparc_sol2
elf32_sparc
elf64_sparc_sol2
elf64_sparc
[y@M610-252126 aiReqResend]$ ll
total 8168
-rwxrwxr-x 1 y y 8350856 Oct 12 19:45 aiReqResend
-rw-rw-r-- 1 y y 8610 Oct 9 15:14 aiReqResend.go