Skip to content

x/mobile: gobind adds local paths to .so file even with -trimpath #73097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xcolwell opened this issue Mar 28, 2025 · 2 comments
Open

x/mobile: gobind adds local paths to .so file even with -trimpath #73097

xcolwell opened this issue Mar 28, 2025 · 2 comments
Labels
BugReport Issues describing a possible bug in the Go implementation. mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@xcolwell
Copy link

Go version

go version go1.24.1 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/brien/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/brien/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/4l/g_hryrh931zd32myc4m67v940000gn/T/go-build2727259303=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/brien/urnetwork/sdk/go.mod'
GOMODCACHE='/Users/brien/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/brien/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/brien/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Our go.mod file contains replace rules to local paths. e.g.

replace github.com/urnetwork/connect => ../connect
replace github.com/urnetwork/connect/protocol => ../connect/protocol
replace github.com/urnetwork/userwireguard => ../userwireguard

What did you see happen?

The lib is built with gomobile bind, and the created .so has the following in the footer:

path        gobind/gobind
mod     gobind  (devel)
dep     github.com/btcsuite/btcutil     v1.0.2  h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts=
dep     github.com/golang-jwt/jwt/v5    v5.2.1  h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
dep     github.com/golang/glog  v1.2.4  h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc=
dep     github.com/google/gopacket      v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
dep     github.com/gorilla/websocket    v1.5.3  h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
dep     github.com/oklog/ulid/v2        v2.1.0  h1:+9lhoxAP56we25tyYETBBY1YLA2SaoLvUFgrP2miPJU=
dep     github.com/urnetwork/connect    v0.0.0
=>      /Users/brien/urnetwork/connect  (devel)

dep     github.com/urnetwork/connect/protocol   v0.0.0
=>      /Users/brien/urnetwork/connect/protocol (devel)

dep     github.com/urnetwork/sdk        v0.0.0-00010101000000-000000000000
=>      /Users/brien/urnetwork/sdk      (devel)

dep     golang.org/x/crypto     v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
dep     golang.org/x/exp        v0.0.0-20250305212735-054e65f0b394      h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
dep     golang.org/x/mobile     v0.0.0-20250305212854-3a7bc9f8a4de      h1:WuckfUoaRGJfaQTPZvlmcaQwg4Xj9oS2cvvh3dUqpDo=
dep     golang.org/x/net        v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
dep     golang.org/x/text       v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
dep     google.golang.org/protobuf      v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
dep     src.agwa.name/tlshacks  v0.0.0-20231008131857-90d701ba3225      h1:KvJgNzDBgG6IawXLCenHhjvU7RXQ5UD1a18Nm2ZMyGg=
build   -buildmode=c-shared
build   -compiler=gc
build   -gcflags=-dwarf=false
build   -trimpath=true
build   CGO_ENABLED=1
build   GOARCH=arm64
build   GOOS=android
build   GOARM64=v8.0

What did you expect to see?

I would expect gomobile bind should trim the absolute paths when using -trimpath, e.g.

/Users/brien/urnetwork/connect should be ../connect
/Users/brien/urnetwork/protocol should be ../protocol
/Users/brien/urnetwork/sdk should be .

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Mar 28, 2025
@gopherbot gopherbot added this to the Unreleased milestone Mar 28, 2025
@dmitshur
Copy link
Contributor

CC @hajimehoshi.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 28, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants