GeertJohan / openwrt-go

Fork of the openwrt project to add gccgo and libgo
GNU General Public License v2.0
244 stars 38 forks source link

How to compile GO 1.6 or GO1.4 to openwrt? #12

Open luo12yan opened 8 years ago

luo12yan commented 8 years ago

GO1.6 finally support MIPS processors, but only supports the MIPS64. MIPS processors are not supported. Ask whether there is support GO1.6 plan? Or to support GO1.4?

You can not provide, modify script shows?

wongsyrone commented 8 years ago

The golang version depends on GCC upstream implementation.

luo12yan commented 8 years ago

Thank you reply。 My English is not good。

In the latest version of the Openwrt , GCC has been upgraded to version 5.3. But no GCCGO and LIBGO compiler options. I want to know how to add it.


妹的。。发现你是中国人。郁闷!用中文再说一次呗。 最新版本的Openwrt。GCC编译器已经更新到了5.3了。我想把GCCGO也加进去。但是不知道要修改哪些部分。

zoobab commented 8 years ago

Gccgo documentation says:

https://golang.org/doc/install/gccgo

./configure --enable-languages=c,c++,go

should produce a gccgo. Giving it a shot.

luo12yan commented 8 years ago

Thank you!@zoobab Sorry,I didn't say it clearly。 The documents I have long seen。 This is my configuration,but not working。 ./configure --target=mipsel-openwrt-linux-gnu --with-gnu-ld --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-multilib --disable-nls --without-isl --without-cloog --with-host-libstdcxx=-lstdc++ --with-float=soft --disable-decimal-float --with-mips-plt --with-diagnostics-color=auto-if-env --enable-libssp --enable-__cxa_atexit --disable-libsanitizer --enable-languages=c,c++,go --enable-shared --enable-threads --enable-lto

My target processor is Mips 32。GO is not the only type of processor supported。

bettermanbao commented 8 years ago

I have successfully cross compile go program into mips32 bin with below command, you may try this also.

GOARCH=mips32 is for ar71xx, change to GOARCH=mips32le if it is ramips.

cd git clone https://github.com/gomini/go-mips32.git cd go-mips32/src export GOOS=linux export GOARCH=mips32 sudo mkdir /opt/mipsgo ./make.bash cd .. sudo cp -R * /opt/mipsgo export GOROOT=/opt/mipsgo export PATH=/opt/mipsgo/bin:$PATH vi helloworld.go go build helloworld.go