RT:
go基本已经通吃了所有主流处理器。MIPS64的处理器也已经支持了,但是唯独MIPS32的处理器不支持。
目前有个需求就是在MIPS处理器上也能用上GO。目前知道的只有GCCGO了。
老版本的gccgo可以编译成功,gcc 4.8.3这个我就成功了
但是新版本我基本上试过,所有的办法去编译mips的gccgo 5.X,6.X版本。
1、直接从GCC源码编译。
2、crosstool-ng工具编译。
3、buildroot工具编译。
4、通过openwrt编译工具编译
都失败了。
工具基本能编译出来(gccgo,go1等),但是库编译就报错,编译不通过。
基本是gcc\libffi\src\mips\o32.s这个文件报错。
94行 l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
101行 l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
等等这样的汇编错误。
我已经搞疯了。实在没招了。
问问有哪位大神搞过MIPS处理器的GCCGO 指导一下。
完整的错误信息如下:
GCCGO编译信息:
Using built-in specs.
COLLECT_GCC=./gccgo
Target: mipsel-unknown-linux-gnu
Configured with: /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=mipsel-unknown-linux-gnu --prefix=/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu --with-sysroot=/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sysroot --enable-languages=c,c++,go --with-arch=mips32r2 --with-abi=32 --with-float=soft --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-134-ge1d494a' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --enable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --with-gmp=/home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/buildtools --with-mpfr=/home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/buildtools --with-mpc=/home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/buildtools --with-isl=/home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --enable-plugin --with-mips-plt --disable-nls --disable-multilib --with-local-prefix=/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sysroot --enable-long-long
Thread model: posix
gcc version 5.3.0 (crosstool-NG crosstool-ng-1.22.0-134-ge1d494a)
错误信息:
[ALL] depbase=`echo src/mips/o32.lo | sed 's|[^/]*$|.deps/&|;s|.lo$||'`;/usr/bin/bash ./libtool --mode=compile /home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/build/build-cc-gcc-final/./gcc/xgcc -B/home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/build/build-cc-gcc-final/./gcc/ -B/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/bin/ -B/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/lib/ -isystem /home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/include -isystem /home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi -I. -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/include -Iinclude -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src -I. -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/include -Iinclude -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src -EL -march=mips32r2 -mabi=32 -msoft-float -minterlink-mips16 -g -Os -MT src/mips/o32.lo -MD -MP -MF $depbase.Tpo -c -o src/mips/o32.lo /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S &&mv -f $depbase.Tpo $depbase.Plo
[ALL ] libtool: compile: /home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/build/build-cc-gcc-final/./gcc/xgcc -B/home/czlz/mips/mipsel-unknown-linux-gnu/.build/mipsel-unknown-linux-gnu/build/build-cc-gcc-final/./gcc/ -B/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/bin/ -B/home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/lib/ -isystem /home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/include -isystem /home/czlz/mips/x-tools/mipsel-unknown-linux-gnu/mipsel-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi -I. -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/include -Iinclude -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src -I. -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/include -Iinclude -I/home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src -EL -march=mips32r2 -mabi=32 -msoft-float -minterlink-mips16 -g -Os -MT src/mips/o32.lo -MD -MP -MF src/mips/.deps/o32.Tpo -c /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S -fPIC -DPIC -o src/mips/.libs/o32.o
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S: Assembler messages:
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:94: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:101: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:109: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:110: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f14,2*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:115: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:116: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f14,1*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:123: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:124: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f14,2*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:131: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:132: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f14,2*4($sp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:161: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.s $f0,0($8)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:168: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f0,0($8)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:265: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f12,((14*4)-10*4)($fp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:266: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f14,((14*4)-8*4)($fp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:285: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f0,((14*4)-6*4)($fp)'
[ALL ] /home/czlz/mips/mipsel-unknown-linux-gnu/.build/src/gcc-5.3.0/libffi/src/mips/o32.S:289: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f0,((14*4)-6*4)($fp)'
#1
更多评论
我用Ubuntn系统测试了gccgo-6 编译go代码可以在ubuntu上,之后安装 gccgo-6-mips-linux-gnu,编译出来的来程序无法在openwrt上运行。
不想折腾下去了。人生苦短,还是少折腾 linux 和 gccgo。
如果那位能让go程序在 openwrt/mips32 上运行,可否告诉我一下。我的Q/Q: 276 846 259
参考:
https://groups.google.com/forum/#!topic/golang-nuts/0PtkEbR-Y7k
https://golang.org/doc/install/gccgo
https://github.com/zoobab/openwrt-15.05-go/blob/dac14e7a64b8925ab1b849fcae518a194a0c0561/build.sh.txt
http://packages.ubuntu.com/yakkety/devel/
命令(gccgo需要ln /usr/bin/mips-linux-gnu-gccgo-6 /usr/bin/gccgo):
go build -x -compiler gccgo --gccgoflags "-Wl,-R,$LD_LIBRARY_PATH -static -Wall -L $ROOTDIR/lib"
打印出来:
WORK=/tmp/go-build439502237
mkdir -p $WORK/_/root/go/test/_obj/
mkdir -p $WORK/_/root/go/test/_obj/exe/
cd /root/go/test
/usr/bin/gccgo -I $WORK -c -g -fgo-relative-import-path=_/root/go/test -o $WORK/_/root/go/test/_obj/_go_.o -Wl,-R,/usr/lib/gcc-cross/mips-linux-gnu/6 -static -Wall -L /lib ./test.go
ar rc $WORK/_/root/go/libtest.a $WORK/_/root/go/test/_obj/_go_.o
cd .
/usr/bin/gccgo -o $WORK/_/root/go/test/_obj/exe/a.out $WORK/_/root/go/test/_obj/_go_.o -Wl,-( -Wl,--whole-archive -Wl,--no-whole-archive -Wl,-) -Wl,-R,/usr/lib/gcc-cross/mips-linux-gnu/6 -static -Wall -L /lib
mv $WORK/_/root/go/test/_obj/exe/a.out test
#2
我用Ubuntn系统测试了gccgo-6 编译go代码可以在ubuntu上,之后安装 gccgo-6-mips-linux-gnu,编译出来的来程序无法在openwrt上运行。
不想折腾下去了。人生苦短,还是少折腾 linux 和 gccgo。
如果那位能让go程序在 openwrt/mips32 上运行,可否告诉我一下。我的Q/Q: 276 846 259
参考:
https://groups.google.com/forum/#!topic/golang-nuts/0PtkEbR-Y7k
https://golang.org/doc/install/gccgo
https://github.com/zoobab/openwrt-15.05-go/blob/dac14e7a64b8925ab1b849fcae518a194a0c0561/build.sh.txt
http://packages.ubuntu.com/yakkety/devel/
命令(gccgo需要ln /usr/bin/mips-linux-gnu-gccgo-6 /usr/bin/gccgo):
go build -x -compiler gccgo --gccgoflags "-Wl,-R,$LD_LIBRARY_PATH -static -Wall -L $ROOTDIR/lib"
打印出来:
WORK=/tmp/go-build439502237
mkdir -p $WORK/_/root/go/test/_obj/
mkdir -p $WORK/_/root/go/test/_obj/exe/
cd /root/go/test
/usr/bin/gccgo -I $WORK -c -g -fgo-relative-import-path=_/root/go/test -o $WORK/_/root/go/test/_obj/_go_.o -Wl,-R,/usr/lib/gcc-cross/mips-linux-gnu/6 -static -Wall -L /lib ./test.go
ar rc $WORK/_/root/go/libtest.a $WORK/_/root/go/test/_obj/_go_.o
cd .
/usr/bin/gccgo -o $WORK/_/root/go/test/_obj/exe/a.out $WORK/_/root/go/test/_obj/_go_.o -Wl,-( -Wl,--whole-archive -Wl,--no-whole-archive -Wl,-) -Wl,-R,/usr/lib/gcc-cross/mips-linux-gnu/6 -static -Wall -L /lib
mv $WORK/_/root/go/test/_obj/exe/a.out test
#3