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: gomobie bind go1.18 package, the api is suspend ... #59020

Open
izouxv opened this issue Mar 14, 2023 · 8 comments
Open

x/mobile: gomobie bind go1.18 package, the api is suspend ... #59020

izouxv opened this issue Mar 14, 2023 · 8 comments
Labels
mobile Android, iOS, and x/mobile WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@izouxv
Copy link

izouxv commented Mar 14, 2023

What version of Go are you using (go version)?

$ go version
go version go1.18.2 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Volumes/Vault/DEV/xvm/golang/default/gopath/pkg/mod"
GOOS="darwin"
GOPATH="/Volumes/Vault/DEV/xvm/golang/default/gopath"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/Volumes/Vault/DEV/xvm/golang/default"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Volumes/Vault/DEV/xvm/golang/default/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lw/cfz6lhfn1zv6mld4_6zs5s680000gn/T/go-build3898754961=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

gomobile latest version, git hash: e0f5769
xcode: 14.1
macOS: 13.1

gomobile bind -ldflags="-w -s" -work -target=macos

it can build a framework, but if it is bind a go package with go.mod version 1.17, the framework no problem,
if it build a go package with go.mod version 1.18, and then all apis will suspend in a xcode project

go 1.17, no problem
go 1.18 and above, all api is suspend

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Mar 14, 2023
@gopherbot gopherbot added this to the Unreleased milestone Mar 14, 2023
@cherrymui
Copy link
Member

Could you clarify what you mean by "all apis will suspend in a xcode project"? Does it fail to build? Fail to run? How do you build or run it in an Xcode project? Thanks.

@cherrymui cherrymui added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 14, 2023
@izouxv
Copy link
Author

izouxv commented Mar 15, 2023

i can build a macos xcframework with the latest gomobile, and import to a macos project.
if the go package' version is 1.17, every is ok
if the go package' version is 1.18, i debug the macos project, Call the xcframework's go api and the program will get stuck

gomobile bind -ldflags="-w -s" -work -target=macos

1.18,call go api,program will get stuck
1.17,every is fine

@izouxv
Copy link
Author

izouxv commented Mar 15, 2023

@cherrymui

@seankhliao
Copy link
Member

note we no longer support 1.17 or 1.18

@izouxv
Copy link
Author

izouxv commented Mar 16, 2023

go 1.20, the error still exist
@seankhliao

@cherrymui
Copy link
Member

Thanks. How do you run the program? On an iOS device? On a simulator? Device connected to Xcode?

@izouxv
Copy link
Author

izouxv commented Mar 17, 2023

no, i run a macos program, not a ios program.
i use the follow cmd to build xcframework
like this:

gomobile bind -ldflags="-w -s" -work -target=macos   \
-o ./build/macos/pkg.xcframework \
pkg/api1 \
pkg/api2 \
pkg/api3

and, the gomobile is also support macos target

gomobile bind  --help
usage: gomobile bind [-target android|ios|iossimulator|macos|maccatalyst] [-bootclasspath <path>] [-classpath <path>] [-o output] [build flags] [package]

if i set target with ios, and i debug with a ios project, erverything is fine
but if i set target with macos,i debug with a macos program, and call the pkg.xcframework's api, the macos program will get stuck

@seankhliao
@cherrymui

@izouxv
Copy link
Author

izouxv commented Mar 22, 2023

-_-

@izouxv izouxv changed the title x/mobile: gomobie bind go1.18 package, the api is suspend x/mobile: gomobie bind go1.18 package, the api is suspend ... Mar 26, 2023
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 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