Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run cross compiled go program on original openwrt mips32 firmware #19

Open
bettermanbao opened this issue Jun 13, 2016 · 4 comments
Open

Comments

@bettermanbao
Copy link

Does anyone know the advantage of re-compile openwrt firmware with this repo? Currently I could run cross compiled go program on original openwrt mips32 firmware, but the performance is very poor.

I tried an UDP tunnel program which written in golang, but when it runs on my mips32 router after cross compiled, the transfer rate is only 2-3Mbps.

So I'm looking for some optimized metheds to run golang on my mips32 router now. Thanks!

My cross compile bin attahed, source code here: https://github.com/xtaci/kcptun

kcptun-client_mips32_little_endian.zip
kcptun-client_mips32_big_endian.zip

@ligf
Copy link

ligf commented Jun 14, 2016

你是怎么编译的 编译时候的参数都有哪些 我编译出来的有7m呢

@bettermanbao
Copy link
Author

cd
git clone https://github.com/gomini/go-mips32.git
cd go-mips32/src
export GOOS=linux
export GOARCH=mips32 <== Change to mips32le if ramips
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

@hbl0307106015
Copy link

hbl0307106015 commented Oct 25, 2016

I have trouble when building mips32go on x86_64 machine, please help me:

/home/tymon/work/test/go-mips32-dev.github/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/tymon/work/test/go-mips32-dev.github/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

cmd/go

/home/tymon/work/test/go-mips32-dev.github/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
/home/tymon/work/test/go-mips32-dev.github/pkg/linux_amd64/runtime/cgo.a(_all.o): unknown relocation type 42; compiled without -fpic?
runtime/cgo(.text): unexpected relocation type 298
runtime/cgo(.text): unexpected relocation type 298

@awgh
Copy link

awgh commented Nov 19, 2016

To make the "unexpected relocation" errors go away, change the ./make.bash command to:
CGO_ENABLED=0 ./make.bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants