我目前正在开发一款带有libGDX的小型多平台游戏。该游戏在Windows,Android和OSX上运行良好,但我无法为iOS编译。
libGDX guide for iOS提出了几个警告,但我很确定我已经考虑了所有因素。我有Eclipse,Xamarin.iOS,JDK,Ant和$ PATH,$ IKVM_HOME设置正确。 gamename.dll(这是包含我所有游戏逻辑的Mono编译的dll,并且是从Java代码自动生成的)已经创建,并且一切看起来都是有序的。
但是,在编译时,我收到以下错误消息:
Error MT5201: Native linking failed. Please review user flags provided to gcc: "-L/Users/blah/Ultralyd/Ultralyd-ios/libs/ios" "-L/Users/blah/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin" "-likvm-natives" "-lgdx" "-force_load" "/Users/blah/Ultralyd/Ultralyd-ios/libs/ios/libgdx.a" "-force_load" "/Users/blah/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin/libikvm-natives.a" (MT5201)
(为简洁起见,Paths缩写了一点。)
这些参数在创建iOS项目时由libGDX自动生成,在Xamarin的项目设置中如下所示:
-nosymbolstrip -nostrip -cxx -gcc_flags "-L${ProjectDir}/libs/ios -L${ProjectDir}/libs/ios/ikvm/bin -likvm-natives -lgdx -force_load ${ProjectDir}/libs/ios/libgdx.a -force_load ${ProjectDir}/libs/ios/ikvm/bin/libikvm-natives.a"
构建输出包含:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ -Wl,-no_pie -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=3.2 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk /Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.cache.vqL1439yU4Eq3JVRLyBeXkLz910=.o -o /var/folders/4p/g1k6g_v51kn35jm5yyh3g74m0000gq/T/tmp1da69439.tmp/iosgame -framework CFNetwork -framework Foundation -framework OpenGLES -framework UIKit -framework AVFoundation -framework QuartzCore -framework CoreGraphics -framework OpenAL -framework AudioToolbox -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/4p/g1k6g_v51kn35jm5yyh3g74m0000gq/T/tmp1da69439.tmp/libObjectAL-universal.a "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios" "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin" "-likvm-natives" "-lgdx" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/libgdx.a" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin/libikvm-natives.a"
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ -Wl,-no_pie -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=3.2 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk /Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.cache.vqL1439yU4Eq3JVRLyBeXkLz910=.o -o /var/folders/4p/g1k6g_v51kn35jm5yyh3g74m0000gq/T/tmp1da69439.tmp/iosgame -framework CFNetwork -framework Foundation -framework OpenGLES -framework UIKit -framework AVFoundation -framework QuartzCore -framework CoreGraphics -framework OpenAL -framework AudioToolbox -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/4p/g1k6g_v51kn35jm5yyh3g74m0000gq/T/tmp1da69439.tmp/libObjectAL-universal.a "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios" "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin" "-likvm-natives" "-lgdx" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/libgdx.a" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin/libikvm-natives.a"
Undefined symbols for architecture i386:
"_AVAudioSessionInterruptionNotification", referenced from:
-[OALAudioSession init] in libObjectAL-universal.a(OALAudioSession.o)
"_AVAudioSessionInterruptionTypeKey", referenced from:
-[OALAudioSession handleInterruption:] in libObjectAL-universal.a(OALAudioSession.o)
"_AVAudioSessionInterruptionOptionKey", referenced from:
-[OALAudioSession handleInterruption:] in libObjectAL-universal.a(OALAudioSession.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
libObjectAL是libGDX在创建项目时自动添加的引用dll之一。
我认为这意味着我的设置出现了问题,但我找不到任何与之相关的内容。
有什么想法吗?
编辑:添加poupou建议的框架后,我现在得到一个略有不同的错误消息: EDIT1b:不,它实际上是一样的。唯一的区别是争论。/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++ -Wl,-no_pie -arch i386 -gdwarf-2 -fobjc-legacy-dispatch -fobjc-abi-version=2 -miphoneos-version-min=3.2 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk /Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/obj/iPhoneSimulator/Debug/mtouch-cache/main.i386.cache.1rmDllI2qRyDYwNzBd+9+oPccNg=.o -o /var/folders/4p/g1k6g_v51kn35jm5yyh3g74m0000gq/T/tmp141160e6.tmp/iosgame -framework CFNetwork -framework Foundation -framework OpenGLES -framework UIKit -framework AVFoundation -framework QuartzCore -framework CoreGraphics -framework OpenAL -framework AudioToolbox -lz -liconv -u _mono_pmip -u _monotouch_create_managed_ref -u _monotouch_release_managed_ref -u _monotouch_IntPtr_objc_msgSend_IntPtr -u _monotouch_IntPtr_objc_msgSendSuper_IntPtr -u _CloseZStream -u _CreateZStream -u _Flush -u _ReadZStream -u _WriteZStream -lmono-2.0 -lmonotouch-debug -L/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/4p/g1k6g_v51kn35jm5yyh3g74m0000gq/T/tmp141160e6.tmp/libObjectAL-universal.a "-framework" "AVFoundation" "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios" "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin" "-likvm-natives" "-lgdx" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/libgdx.a" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin/libikvm-natives.a"
Undefined symbols for architecture i386:
"_AVAudioSessionInterruptionNotification", referenced from:
-[OALAudioSession init] in libObjectAL-universal.a(OALAudioSession.o)
"_AVAudioSessionInterruptionTypeKey", referenced from:
-[OALAudioSession handleInterruption:] in libObjectAL-universal.a(OALAudioSession.o)
"_AVAudioSessionInterruptionOptionKey", referenced from:
-[OALAudioSession handleInterruption:] in libObjectAL-universal.a(OALAudioSession.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
error MT5201: Native linking failed. Please review user flags provided to gcc: "-framework" "AVFoundation" "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios" "-L/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin" "-likvm-natives" "-lgdx" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/libgdx.a" "-force_load" "/Users/erlenddahl/Copy/UltralydDebugging/Libgdx/Ultralyd/Ultralyd-ios/libs/ios/ikvm/bin/libikvm-natives.a"
答案 0 :(得分:3)
您的一个本机库(日志中的libObjectAL
)要求 AVFoundation 框架与您的应用程序相关联。
注意:您可以从未找到的类型的_AV*
前缀稍微猜测它。
解决方案:将-framework AVFoundation
添加到-gcc_flags
并重建您的应用程序。
答案 1 :(得分:2)
所以需要-framework AVFoundation
,至少如果你的应用程序没有引用MonoTouch.AVFoundation
中的类型。在后一种情况下,框架将自动链接。
OTOH三个符号有另一个共同点:它们在iOS6中是全部新的。
它转变为我们正在构建针对iOS 5.1,即
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
因此符号不存在(在被引用的AVFoundation.framework
中),libObjectAL-universal.a
对丢失的符号不满意。
从那里你有两个选择:
将您的最低版本设置为iOS6(已占有93%的市场份额);
尝试在iOS 6 API上找不到(或构建)没有依赖关系的libObjectAL
。