Open unifyproxy opened 5 years ago
/cc @hyangah
I hit this issue while trying to build this project: ipfs-shipyard/gomobile-ipfs (from the packages
folder)
go version 1.18.2 was being used and there was one go module in dependency chain requiring go 1.17:
# github.com/lucas-clemente/quic-go/internal/qtls
../pkg/mod/github.com/lucas-clemente/quic-go@v0.24.0/internal/qtls/go118.go:6:13: cannot use "quic-go doesn't build on Go 1.18 yet." (untyped string constant) as int value in variable declaration
[...]
github.com/ipfs/go-pinning-service-http-client
golang.org/x/mobile/bind/seq
golang.org/x/mobile/bind/java
/tmp/go-build1282703176/b001/exe/gomobile: go build -v -buildmode=c-shared -o=/tmp/gomobile-work-69347995/android/src/main/jniLibs/armeabi-v7a/libgojni.so ./gobind failed: exit status 2
exit status 1
make: *** [Makefile:112: /home/wesley/devel/gomobile-ipfs/packages/build/android/intermediates/core/core.aar] Error 1
I've installed go 1.17.11 and it fixed the issue for me.
go env
output: @WesleyBatista Your issue is not the same. github.com/lucas-clemente/quic-go
does not support Go 1.18 until 0.25.0
. See https://github.com/lucas-clemente/quic-go/releases/tag/v0.25.0
@ZekeLu thanks for your comment!
I understand my issue is not the same, but I believe the root cause lies in the fact that there was an unexpected outcome during the build (a package/module failed to build) that ultimately caused the exit status 2
we see at the end, which is pretty much the same as op.
In my case the problem was the go version, but exit code 2 could be anything that fails and causes a misuse of shell built-ins, as described here: https://tldp.org/LDP/abs/html/exitcodes.html
does anybody have any idea how to fix the problem that @unifyproxy mentioned?
i tried to generate .aar file but i get the same error
go version => 1.20
ndk version => 21.3.6528147 (tried to use the latest but i get an error so i switch to the earlier one and then fix the problem with ndk version)
but i get the same error when trying to bind go code (gomobile bind -v -androidapi 19 -ldflags='-s -w' ./
)
repo =>V2fly
error =>
# gobind/gobind core_android.c:272:1: error: redefinition of 'Java_core_InboundHandlerConfig_getTag' core_android.c:235:1: note: previous definition is here core_android.c:377:1: error: redefinition of 'Java_core_OutboundHandlerConfig_getTag' core_android.c:340:1: note: previous definition is here core_android.c:396:1: error: redefinition of 'Java_core_OutboundHandlerConfig_getExpire' core_android.c:328:1: note: previous definition is here core_android.c:411:1: error: redefinition of 'Java_core_OutboundHandlerConfig_getComment' core_android.c:320:1: note: previous definition is here gomobile: go build -v -ldflags -s -w -buildmode=c-shared -o=/tmp/gomobile-work-2973778891/android/src/main/jniLibs/arm64-v8a/libgojni.so ./gobind failed: exit status 1
What version of Go are you using (
go version
)?What version of Gomobile are you using (
gomobile version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
nothing (build success)
What did you see instead?
Error