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/toolchain@v0.0.1-go1.24.1.darwin-arm64'
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/toolchain@v0.0.1-go1.24.1.darwin-arm64/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.
Comment From: gabyhelp
Related Issues
- x/mobile: os.Executable() panics on iOS #22529 (closed)
- x/mobile/cmd/gomobile: gomobile bind fails with Xcode 15 #63141 (closed)
- gomobile bind -target ios fails #63162 (closed)
- x/mobile: Unable to build xcframework with gomobile and Xcode 14 #53316 (closed)
- gomobile can't gobind on Xcode 15.2 #65807 (closed)
- x/mobile: gomobile bind produces broken xcframework when used with Xcode 14 #55028 (closed)
- x/mobile: iOS project won't compile with framework built by gomobile #32918
- x/sys: gomobile build failed for x/crypto/ssh/terminal #22727 (closed)
- x/mobile: building for iOS Simulator, but linking in object file built for iOS, for architecture arm64. #45805
- I want to run a go project on iOS , but I have some issues #27620 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: cherrymui
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.
Comment From: cherrymui
cc @hajimehoshi
Comment From: invented-pro
@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?
Comment From: gopherbot
Timed out in state WaitingForInfo. Closing.
(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)
Comment From: cherrymui
Is that a known behavior on Xcode 16? or any workaround?
I don't know. I don't have a phone at hand to test this easily. Maybe @golang/ios maintainers know?