Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

gomobile, go mod, and go1.16 #82

Closed
ignoramous opened this issue Apr 13, 2021 · 2 comments
Closed

gomobile, go mod, and go1.16 #82

ignoramous opened this issue Apr 13, 2021 · 2 comments

Comments

@ignoramous
Copy link
Contributor

ignoramous commented Apr 13, 2021

I tried but couldn't build outline-go-tun2socks with go1.16. It may have to do with the recent changes with go modules in 1.16 but I haven't been able to get to the bottom of it.

The gomobile wiki asks to set go env GO111MODULE=auto, which is set, but the builds still fail:

switch version

  outline-go-tun2socks git:(master) gvm use go1.16
Now using version go1.16.3

build failure:

➜  outline-go-tun2socks git:(master) ./build_android.sh intra
+ readonly BUILD_DIR=build/android
+ BUILD_DIR=build/android
++ mktemp
+ readonly LOG_FILE=/tmp/tmp.DJoid85xXO
+ LOG_FILE=/tmp/tmp.DJoid85xXO
+ readonly TARGET=android-intra
+ TARGET=android-intra
+ rm -rf build/android
+ make clean
rm -rf /home/murtaza/hub/outline-go-tun2socks/build
+ make android-intra
+ tee /tmp/tmp.DJoid85xXO
mkdir -p /home/murtaza/hub/outline-go-tun2socks/build/android
eval ""gomobile bind -a -ldflags '-w'  -target=android -tags android -work -o /home/murtaza/hub/outline-go-tun2socks/build/android/tun2socks.aar" github.com/Jigsaw-Code/outline-go-tun2socks/intra github.com/Jigsaw-Code/outline-go-tun2socks/intra/android github.com/Jigsaw-Code/outline-go-tun2socks/intra/doh github.com/Jigsaw-Code/outline-go-tun2socks/intra/split github.com/Jigsaw-Code/outline-go-tun2socks/intra/protect"
WORK=/tmp/gomobile-work-296560557
gomobile: go build -tags android -ldflags -w -work -buildmode=c-shared -o=/tmp/gomobile-work-296560557/android/src/main/jniLibs/armeabi-v7a/libgojni.so ./gobind failed: exit status 1
WORK=/tmp/gomobile-work-296560557/go-build3347104436
go: github.com/BurntSushi/[email protected]: missing go.sum entry; to add it:
	go mod download github.com/BurntSushi/xgb

make: *** [Makefile:42: android-intra] Error 1
++ cat /tmp/tmp.DJoid85xXO
++ grep WORK=
++ cut -f2 -d=
+ readonly 'GO_WORK_DIR=/tmp/gomobile-work-296560557
/tmp/gomobile-work-296560557/go-build3347104436'
+ GO_WORK_DIR='/tmp/gomobile-work-296560557
/tmp/gomobile-work-296560557/go-build3347104436'
+ '[' '!' -z /tmp/gomobile-work-296560557 /tmp/gomobile-work-296560557/go-build3347104436 ']'
./build_android.sh: line 29: [: /tmp/gomobile-work-296560557: binary operator expected

go env:

➜  outline-go-tun2socks git:(master) go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/u/.cache/go-build"
GOENV="/home/u/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/u/.gvm/pkgsets/go1.16.3/global/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/u/.gvm/pkgsets/go1.16.3/global"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/u/.gvm/gos/go1.16.3"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/u/.gvm/gos/go1.16.3/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/u/hub/outline-go-tun2socks/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3210367305=/tmp/go-build -gno-record-gcc-switches"

Refetching deps go get -d ./... / re-downloading gomobile / re-initing gomobile didn't work.

@ignoramous
Copy link
Contributor Author

building with

go env -w GOFLAGS=-mod=mod

fixes it.

From: golang/go#44129

@ignoramous
Copy link
Contributor Author

ignoramous commented Jun 3, 2022

This problem doesn't exist with go1.18 and gomobile transitioning to / working well with install.

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

No branches or pull requests

1 participant