Skip to content
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

x/mobile: os.Executable() panic on Xcode16 #72966

Open
invented-pro opened this issue Mar 20, 2025 · 4 comments
Open

x/mobile: os.Executable() panic on Xcode16 #72966

invented-pro opened this issue Mar 20, 2025 · 4 comments
Labels
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. OS-iOS GOOS=ios WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@invented-pro
Copy link

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='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/sun/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/sun/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/fx/t6n0q569167394bhkc1gp9mh0000gn/T/go-build426215983=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/sun/Documents/GitHub/tslib/go.mod'
GOMODCACHE='/Users/sun/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/sun/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/Users/sun/go/pkg/mod/golang.org/[email protected]'
GOSUMDB='sum.golang.org'
GOTELEMETRY='off'
GOTELEMETRYDIR='/Users/sun/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/sun/go/pkg/mod/golang.org/[email protected]/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Use "gomobile bind -target=ios" to build a xcframework library, used in Flutter iOS app.

What did you see happen?

When using Xcode 15.0(15A240d), os.Executable() returns “/var/containers/Bundle/Application/E80602C7-EFFB-4F1B-9FF8-FBA0E7E3DA76/Runner.app/Runner” as normal. All goes fine.

But with Xcode 16.2(16C5032a), os.Executable() panic with err “cannot find executable path”.

What did you expect to see?

os.Executable() should return executable path as before on Xcode 16.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Mar 20, 2025
@gopherbot gopherbot added this to the Unreleased milestone Mar 20, 2025
@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Mar 20, 2025
@cherrymui
Copy link
Member

Are you running on an iOS device, or in a simulator?

In the case that it cannot find the path, it should return an error cannot find executable path, but should not panic. Could you check if it actually panics? If so, could you provide a stack trace? Thanks.

@cherrymui
Copy link
Member

cc @hajimehoshi

@cherrymui cherrymui added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. OS-iOS GOOS=ios and removed BugReport Issues describing a possible bug in the Go implementation. labels Mar 21, 2025
@invented-pro
Copy link
Author

@cherrymui I tested on physical iPhone, not simulator.

To be precise, it returns that error, not panic -- as following indicated.

https://go.dev/src/os/executable_darwin.go

The error in return blocks app's function.

Is that a known behavior on Xcode 16? or any workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. OS-iOS GOOS=ios WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants