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: building 2 independent xcframeworks for iOS Simulator, but crash when app start up #50594

Open
pipi32167 opened this issue Jan 13, 2022 · 1 comment

Comments

@pipi32167
Copy link

@pipi32167 pipi32167 commented Jan 13, 2022

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

$ go version
go version go1.17.6 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/x/Library/Caches/go-build"
GOENV="/Users/x/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/x/.gvm/pkgsets/go1.17.6/global/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/x/.gvm/pkgsets/go1.17.6/global"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/Users/x/.gvm/gos/go1.17.6"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/x/.gvm/gos/go1.17.6/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/private/tmp/golang-crash-test/go.mod"
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vd/lrhd0qbn1t56jjs5ml_81_w00000gp/T/go-build4026723300=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Building 2 independent xcframeworks for iOS App to use.

gomobile bind -tags test1 -target=ios -o build/golang_crash_test1.xcframework ./crash
gomobile bind -tags test2 -target=ios -o build/golang_crash_test2.xcframework ./crash

And then use the xcframeworks in the Xcode project

What did you expect to see?

The iOS program is able to run properly.

What did you see instead?

The iOS program running crash with the callstack:

#0	0x000000010e814d55 in debugCall65536 ()
#1	0x000000010ed76899 in invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const ()
#2	0x000000010ed92941 in invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const ()
#3	0x000000010ed8be09 in invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const ()
#4	0x000000010ed8af5f in dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const ()
#5	0x000000010ed8bb93 in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const ()
#6	0x000000010ed923a2 in dyld3::MachOAnalyzer::forEachInitializerPointerSection(Diagnostics&, void (unsigned int, unsigned int, unsigned char const*, bool&) block_pointer) const ()
#7	0x000000010ed925e4 in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const ()
#8	0x000000010ed767cc in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const ()
#9	0x000000010ed76958 in dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const ()
#10	0x000000010ed769f6 in dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const ()
#11	0x000000010ed852d8 in dyld4::APIs::runAllInitializersForMain() ()
#12	0x000000010ed69920 in dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) ()
#13	0x000000010ed69d3f in _dyld_sim_prepare ()
#14	0x00000001145fcb24 in dyld4::prepareSim(dyld4::RuntimeState&, char const*) ()
#15	0x00000001145fb6de in dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) ()
#16	0x00000001145fb4b4 in start ()
@gopherbot gopherbot added this to the Unreleased milestone Jan 13, 2022
@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Jan 13, 2022

@hyangah can you give this a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants