I've been working on this problem for a whole day and very stuck. I'd love help.
I am trying to compile a C/Go code to run in my iOS swift app. The library compiles fine for normal amd64 architecture.
To do the compilation I start 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 build -ldflags -w -v -tags ios -o "storj_uplink-arm64.a" -buildmode=c-archive
The next step after I use 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 files build phase. From Swift, I check various symbol addresses that I need and I can confirm beyond that step. However when the actual binary is running, I receive a series 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 signal 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
Based on these errors and steps, I believe this has to do with the Go build process, but it's not clear what is breaking. In case this helps, I'm using the Storj uplink-c to Swift bindings (relevant ticket here). People seem pretty convinced the C library is fine and suggested I go to the Go community for more debugging.