Friday, April 17, 2026
HomeiOS Developmentswift - Go compilation for iOS

swift – Go compilation for iOS

[ad_1]

I have been engaged on this downside for an entire day and really caught. I would love assist.

I’m making an attempt to compile a C/Go code to run in my iOS swift app. The library compiles nice for regular amd64 structure.

To do the compilation I begin with this compilation step which generate a static .a archive.

GOOS=ios GOARCH=arm64 CGO_ENABLED=1 CC=$(go env
GOROOT)/misc/ios/clangwrap.sh go construct -ldflags -w -v -tags ios -o
“storj_uplink-arm64.a” -buildmode=c-archive

The subsequent step after I take advantage of a scrub conversion to a dylib

xcrun -sdk iphoneos clang -arch arm64 -fpic -shared -Wl,-all_load
storj_uplink-arm64.a -framework Corefoundation -o libuplinkc.dylib

In Xcode, I drag the dependency to the copy information construct part. From Swift, I examine varied image addresses that I would like and I can verify past that step. Nonetheless when the precise binary is working, I obtain a sequence of runtime errors.

dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

In lldb debugger, this message is given with a Thread 12 sign SIGILL error.

libuplinkc.dylib`golang.org/x/sys/cpu.getisar0:
->  0x10c7a36f0 <+0>:  mrs    x0, ID_AA64ISAR0_EL1
    0x10c7a36f4 <+4>:  str    x0, [sp, #0x8]
    0x10c7a36f8 <+8>:  ret    
    0x10c7a36fc <+12>: udf    #0x0

Primarily based on these errors and steps, I imagine this has to do with the Go construct course of, but it surely’s not clear what’s breaking. In case this helps, I am utilizing the Storj uplink-c to Swift bindings (related ticket right here). Folks appear fairly satisfied the C library is okay and instructed I am going to the Go group for extra debugging.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments