SaeedDev94 / Xray

Xray GUI Client For Android
MIT License
194 stars 23 forks source link

How compile #38

Closed evgenybozhko2 closed 1 week ago

evgenybozhko2 commented 1 week ago

How the project can be compiled on MacOs?

no exported names in the package "XrayCore" unable to import bind: no Go package in golang.org/x/mobile/bind unable to import bind: no Go package in golang.org/x/mobile/bind no exported names in the package "XrayCore" no exported names in the package "XrayCore" no exported names in the package "XrayCore" "golang.org/x/mobile/bind" is not found; run go get golang.org/x/mobile/bind: no Go package in golang.org/x/mobile/bind gomobile: /Users/user/go/bin/gobind -lang=go,java -outdir=/var/folders/46/j_n6mpd96b5cj1_9r8zx61cm0000gn/T/gomobile-work-323918958 XrayCore failed: exit status 1

evgenybozhko2 commented 1 week ago

PWD=$WORK/src-android-386 GOMODCACHE=$GOPATH/pkg/mod GOOS=android GOARCH=386 CC=$ANDROID_HOME/ndk/27.1.12297006/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang CXX=$ANDROID_HOME/ndk/27.1.12297006/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android26-clang++ CGO_ENABLED=1 GOPATH=$WORK:$GOPATH go build -v -x -ldflags -buildid= -trimpath -buildmode=c-shared -o=$WORK/android/src/main/jniLibs/x86/libgojni.so ./gobind WORK=/var/folders/46/j_n6mpd96b5cj1_9r8zx61cm0000gn/T/go-build3065890505 /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/adapters/gonet/gonet.go:29:2: found packages stack (addressable_endpoint_state.go) and bridge (bridge_test.go) in /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/stack /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/adapters/gonet/gonet.go:29:2: found packages stack (addressable_endpoint_state.go) and bridge (bridge_test.go) in /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/stack /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/adapters/gonet/gonet.go:29:2: found packages stack (addressable_endpoint_state.go) and bridge (bridge_test.go) in /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/stack /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/adapters/gonet/gonet.go:29:2: found packages stack (addressable_endpoint_state.go) and bridge (bridge_test.go) in /Users/user/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20241101212723-22d58ca31b96/pkg/tcpip/stack rm -r -f "$WORK" gomobile: go build -v -x -ldflags -buildid= -trimpath -buildmode=c-shared -o=/var/folders/46/j_n6mpd96b5cj1_9r8zx61cm0000gn/T/gomobile-work-1323311329/android/src/main/jniLibs/x86_64/libgojni.so ./gobind failed: exit status 1

SaeedDev94 commented 1 week ago

Please take a look at the GitHub workflow file.

evgenybozhko2 commented 1 week ago

Please take a look at the GitHub workflow file.

Hmm, I'm waste whole day to compile XrayCore libs with Go mobile. Nothing works, the issue with gvisor dependency. I have no idea what you talking about. build-xray.sh Of course a partly commands using in mac os not work. They can't be compiled with the Go. Do you know how to solve that? Without abstractions?

evgenybozhko2 commented 1 week ago

Full log file. full_log.txt

SaeedDev94 commented 1 week ago

build-xray.sh builds the whole app (docker runs the script)
I recommend it, you can edit it for yourself to build the app
I usually use buildXrayCore.sh which only builds Xray-core with gomobile, it's working great on my x86_64 system running debian 12
Unfortunately I don't have MacOS to test the build process on it

evgenybozhko2 commented 1 week ago

build-xray.sh builds the whole app (docker runs the script) I recommend it, you can edit it for yourself to build the app I usually use buildXrayCore.sh which only builds Xray-core with gomobile, it's working great on my x86_64 system running debian 12 Unfortunately I don't have MacOS to test the build process on it

Thank you for response. Ecxaclty yes, I'm dancing around this project. And yes, compile with gomobile has some conflicts in mac os. From that build file there a lot not exists tools from linux distributions.