gccgo-gcc510-sparc交叉编译错误:1. libgcc_s.so.1:未找到版本“ GCC_4.2.0” 2. libgcc_s.so.1:错误的ELF类型:ELFCLASS32

As title said, I got error like "libgcc_s.so.1: version `GCC_4.2.0' not found", please someone who knows help, thanks a lot.

I am cross compiling a small program with golang with gcc5.1.0 on a Redhat 6.5 x86_64 host for Sparc Solaris 10. I copied the library folders and some other folders from Solaris to my Redhat host and finally I got a gccgo compiler file whose name is sparc-sun-solaris2.10-gccgo (with help from: http://ggolang.blogspot.com/2015/05/gccgo-gcc510-cross-compile-for-sparc.html). Then I compile with below command:

go build --compiler gccgo --gccgoflags "-v -static-libgo -Wl,-dy -lnsl -lsocket -lrt" aiReqResend.go

It results a excutable file (seems works fine): aiReqResend

But when copy the executable aiReqResend to solaris machine and run it, it went wrong, error info:

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 results and gcc version on Solaris machine:

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

Output of running the gccgo compile command:

[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
duanchuli5647
duanchuli5647 啊,是的,忘记了它被列为源中的目标,但是没有完整的端口。
接近 3 年之前 回复
dtnmuyoiw680512744
dtnmuyoiw680512744 gc不支持sparc,仅支持amd64
接近 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问