我目前正在使用libGDX开发一个小型的多平台游戏。该游戏在Windows、Android和OSX上运行良好,但我无法使其编译为iOS版本。根据libGDX 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)
为了简洁起见,路径有所缩写。
这些参数是在创建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 自动添加的引用之一。
我猜测这意味着我的设置有问题,但我找不到任何看起来与此相关的内容。
有任何想法吗?
编辑:按照 poupou 建议添加框架后,现在我得到了一个略微不同的错误信息:
编辑1b:不,实际上是相同的。唯一的区别在于参数。
/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"
-gcc_flags
中。另一方面,我打错了一个字(已修正),应该是-framework AVFoundation
,而不是--framework AVFoundation
(只有一个-
)。 - poupou