Jigsaw-Code / outline-go-tun2socks

Apache License 2.0
224 stars 94 forks source link

gobind is not in the path #89

Closed linsui closed 2 years ago

linsui commented 2 years ago

I have to add $GOPATH/bin into path manully. I thought this should be added into the makefile since the gomobile is installed with make.

bemasc commented 2 years ago

Does the make command not work for you? With the new build instructions, it should not be necessary to execute gobind manually.

linsui commented 2 years ago

I need to add the $GOPATH/bin into the path else it can't find gobind.

bemasc commented 2 years ago

Have you sync'd to HEAD? Are you following the instructions from the README? Can you share the command you ran and the error message you received? What OS are you using?

ignoramous commented 2 years ago

linsui, are you're on golang 1.18+? go install is finicky (and in fact wouldn't even work on older versions).

linsui commented 2 years ago

I'm using go 1.18.3. I got

touch go.mod
env GOBIN=/builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/bin go install golang.org/x/mobile/cmd/gomobile
/builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/bin/gomobile init
mkdir -p /builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/build/intra
/builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/bin/gomobile bind -a -ldflags '-w' -target=android -tags android -work -o /builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/build/intra/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-3757592961
/builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/bin/gomobile: gobind was not found. Please run gomobile init before trying again
Makefile:17: recipe for target '/builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/build/intra/tun2socks.aar' failed
make: *** [/builds/linsui/fdroiddata/build/srclib/outline-go-tun2socks/build/intra/tun2socks.aar] Error 1

when I ran make intra. I install go with

curl -Lso go.tar.gz https://go.dev/dl/go1.18.3.linux-amd64.tar.gz
echo "956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245 go.tar.gz" | sha256sum -c -
tar xzf go.tar.gz --strip-components=1 -C /usr/local/

on Debian Stretch.

PATH="$HOME/go/bin:$PATH" make intra works.

ignoramous commented 2 years ago

PATH="$HOME/go/bin:$PATH" make intra works.

This is required and standard, one would think?

on Debian Stretch.

On my deb (buster), I use gvm install -B go1.18 for local golang; followed by gvm use go1.18 (which sets PATH as approp for that session).

linsui commented 2 years ago

This is required and standard, one would think?

When I install gomobile manully I'll set GOPATH and PATH. When I leave it to the makefile I would expect that it's maintained by the makefile especially when the gomobile binary is installed into a relative path.