kuoruan / openwrt-v2ray

V2Ray for OpenWrt
MIT License
2.21k stars 462 forks source link

按照提示编译不通过 #10

Closed CHN-beta closed 5 years ago

CHN-beta commented 5 years ago

使用 WNDR4300 18.06.2 的 SDK,在 Deepin 15.10.1 下编译。

直接按照 README.md 中提示编译时,会提示类似于下面的错误(有很多,只截取了前三条):

src/v2ray.com/core/config.go:9:2: cannot find package "github.com/golang/protobuf/proto" in any of:
    /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/lib/go-cross/src/github.com/golang/protobuf/proto (from $GOROOT)
    /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/v2ray-core-4.19.1/.go_work/build/src/github.com/golang/protobuf/proto (from $GOPATH)
src/v2ray.com/core/app/router/condition.go:8:2: cannot find package "go.starlark.net/starlark" in any of:
    /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/lib/go-cross/src/go.starlark.net/starlark (from $GOROOT)
    /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/v2ray-core-4.19.1/.go_work/build/src/go.starlark.net/starlark (from $GOPATH)
src/v2ray.com/core/app/router/condition.go:9:2: cannot find package "go.starlark.net/syntax" in any of:
    /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/lib/go-cross/src/go.starlark.net/syntax (from $GOROOT)
    /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/v2ray-core-4.19.1/.go_work/build/src/go.starlark.net/syntax (from $GOPATH)

我设法解决这个问题。我的电脑(Linux)上已经部署好了 GO 的开发环境,并且之前尝试编译过x64的v2ray,因此直接将 /home/chn/go/src 中相关的包复制到了 ./build_dir/target-mips_24kc_musl/v2ray-core-4.19.1/.go_work/build/src 中。

再次编译,提示 undefined: net.ListenConfig 。查找到是因为 GO 的版本过低。

因此,我将整个 SDK 清理干净后(整个删掉再重新下载),更新、安装 feeds,并修改了 ./feeds/packages/lang/golang/golang-version.mk 中的版本为 1.12.5(原先是1.10.3),同时修改HASH。重新编译 v2ray,提示以下错误:

# crypto/rc4
../../../../../staging_dir/hostpkg/lib/go-cross/src/crypto/rc4/rc4_ref.go:11:18: (*Cipher).XORKeyStream redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/crypto/rc4/rc4.go:61:6
../../../../../staging_dir/hostpkg/lib/go-cross/src/crypto/rc4/rc4_ref.go:12:3: c.xorKeyStreamGeneric undefined (type *Cipher has no field or method xorKeyStreamGeneric)
runtime
# runtime
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:65:2: bucketCntBits redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:64:18
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:66:2: bucketCnt redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:65:23
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:70:2: loadFactorNum redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:69:18
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:71:2: loadFactorDen redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:70:18
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:77:2: maxKeySize redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:76:17
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:78:2: maxValueSize redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:77:17
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:83:2: dataOffset redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:85:4
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:94:2: evacuatedX redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:93:19
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:95:2: evacuatedY redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:94:19
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:96:2: evacuatedEmpty redeclared in this block
    previous declaration at ../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/hashmap.go:92:19
../../../../../staging_dir/hostpkg/lib/go-cross/src/runtime/map.go:96:2: too many errors
make[2]: *** [Makefile:290: /home/chn/Desktop/openwrt-sdk-18.06.2-ar71xx-nand_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/v2ray-core-4.19.1/.built] Error 2

请问,我应该怎么办呢?

kuoruan commented 5 years ago

请仔细阅读编译说明。 需要 snapshot SDK