shawn1m / overture

A customized DNS relay server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

有没有交叉编译教程

opened this issue · comments

类似这种的
https://github.com/xtaci/kcptun/wiki/mip32-cross-compile

fpu默认都是关闭的 开启很麻烦 开启之后也用不了官方源kmod模块

https://downloads.lede-project.org/releases/17.01.0/targets/ar71xx/nand/packages/
可以看到完整的kmod数量有600+ 为了一个fpu选项而单独去编译这些依赖 实在让人难以接受 不如用 gomini

参照那个 wiki 改了一下

#mips版
cd ~
git clone https://github.com/gomini/go-mips32.git
cd go-mips32/src
export GOOS=linux
export GOARCH=mips32
./make.bash 
CGO_ENABLED=0 ./make.bash

export GOPATH=~/go-mips32/src/gocode
export GOOS=linux
export GOARCH=mips32
export GOROOT=~/go-mips32
export PATH=~/go-mips32/bin:$PATH

go get -v github.com/shawn1m/overture/main

VERSION=`date -u +%Y%m%d`
LDFLAGS="-X main.VERSION=$VERSION -s -w"
env CGO_ENABLED=0 GOOS=linux GOARCH=mips32 go build -ldflags "$LDFLAGS" -o ~/overture_linux_mips github.com/shawn1m/overture/main

mipsel版本 修改 GOARCH 参数即可

export GOARCH=mips32le

发现官方已经支持没有开FPU的固件了
这个特性在go1.9会实现
https://github.com/golang/go/milestone/49
但是补丁早就已经出了 我试了可以用
https://go-review.googlesource.com/c/37958/
安装方法:
下载解压重命名文件夹到 ~/go 并编译
https://go.googlesource.com/go/+archive/861c5364826a25e50ac351df720bee24e8e10f9b.tar.gz
编译指令

cd ~/go/src
env GOARCH=mips ./make.bash

编译好了之后 正式开始编译overture mips版

~/go/bin/go get -v github.com/shawn1m/overture/main
env GOOS=linux GOARCH=mips GOMIPS=soft-float,mips32 ~/go/bin/go build -ldflags "-s -w" -a -o ~/overture_linux_mips github.com/shawn1m/overture/main
commented

非常感谢,我等会把这个 issue 链接放到 README 里去,在 go 1.9 之前 mips 的问题还是很多。

原以为go 1.9.2已经merge了这个commit,没想到折腾半天,这个commit还没有merge进去。用了 @suikatomoki 的go版本可以,感谢。