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!
Afficher les réponses par date
It looks like you need some 'extern "C" { }' around some code somewhere. Perhaps you have a "-x c++" option set? It looks like there is some name mangling (on account of the linker knowing what parameters it's looking for).
This exact moment, I'm working on a Cocoapod podspec so people can just bring in gambit to an iOS project. I don't know what's involved, but I'm definitely willing to help with gambit on iPhone.
-Jason
On Sat, Apr 13, 2013 at 9:53 PM, Axis Sivitz aosivitz@gmail.com wrote:
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!
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Thanks for the hints. The problem was indeed related to C++ code. I had many files that were objc++ (including ViewController.mm). I'm not sure how to properly link everything, so instead I'm moving back to pure objc code, which I had been meaning to do anyway.
On Apr 13, 2013, at 10:07 PM, Jason Felice wrote:
It looks like you need some 'extern "C" { }' around some code somewhere. Perhaps you have a "-x c++" option set? It looks like there is some name mangling (on account of the linker knowing what parameters it's looking for).
This exact moment, I'm working on a Cocoapod podspec so people can just bring in gambit to an iOS project. I don't know what's involved, but I'm definitely willing to help with gambit on iPhone.
-Jason
On Sat, Apr 13, 2013 at 9:53 PM, Axis Sivitz aosivitz@gmail.com wrote: 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!
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list