I'm trying to get Gambit working for iOS development. I've successfully built libgambc.a for the all three architectures (i386, armv7, armv7s), but I'm getting linker errors when compiling for both the simulator and the device:
Undefined symbols for architecture i386:
"___cleanup()", referenced from:
gambit_cleanup() in ViewController.o
"___setup_params_reset(___setup_params_struct*)", referenced from:
gambit_setup() in ViewController.o
"___disable_heartbeat_interrupts()", referenced from:
gambit_setup() in ViewController.o
"___NONNULLCHARSTRINGLIST_to_NONNULLUCS_2STRINGLIST(char**, unsigned short***)", referenced from:
gambit_setup() in ViewController.o
"___setup(___setup_params_struct*)", referenced from:
gambit_setup() in ViewController.o
"_main_argv", referenced from:
gambit_setup() in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I built the library using the build-gambit-iOS script with the following changes:
ios_version="6.1"
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH"
^---This is what Xcode uses now instead of a separate compiler binary for each platform.
And I changed the compiler to clang.
Some more info:
$ file libgambc.a
libgambc.a: Mach-O universal binary with 3 architectures
libgambc.a (for architecture i386): current ar archive random library
libgambc.a (for architecture armv7): current ar archive random library
libgambc.a (for architecture cputype (12) cpusubtype (11)): current ar archive random library
$ nm libgambc.a | grep ___disable_heartbeat
U ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
00000450 T ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
000003a0 T ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
000003a0 T ____disable_heartbeat_interrupts
U ____disable_heartbeat_interrupts
Here's the failing build command (for simulator):
Ld /Users/asdf/Library/Developer/Xcode/DerivedData/flip-fcbkezkyqdgezscmmmtweckhrzoj/Build/Products/Debug-iphonesimulator/flip.app/flip normal i386
cd /Users/asdf/Development/flip
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/asdf/Library/Developer/Xcode/DerivedData/flip-fcbkezkyqdgezscmmmtweckhrzoj/Build/Products/Debug-iphonesimulator -L/Users/asdf/Downloads/gambc-v4_6_7-devel/misc/gambit-iOS/current/lib -F/Users/asdf/Library/Developer/Xcode/DerivedData/flip-fcbkezkyqdgezscmmmtweckhrzoj/Build/Products/Debug-iphonesimulator -filelist /Users/asdf/Library/Developer/Xcode/DerivedData/flip-fcbkezkyqdgezscmmmtweckhrzoj/Build/Intermediates/flip.build/Debug-iphonesimulator/flip.build/Objects-normal/i386/flip.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -lgambc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -stdlib=libc++ -mios-simulator-version-min=6.1 -framework OpenAL -framework AudioToolbox -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -framework GLKit -framework OpenGLES -o /Users/asdf/Library/Developer/Xcode/DerivedData/flip-fcbkezkyqdgezscmmmtweckhrzoj/Build/Products/Debug-iphonesimulator/flip.app/flip
Any advice is appreciated. Thanks!