How to fix OALAudio Library for XCode 6 / Kobold2D (Linker Error)

十年热恋 提交于 2020-01-17 08:39:06

问题


trying to update a Kobold2D/Cocos2d 2.1 project for iOS 8.1/XCode 6 on Yosemite.

After using the solution provided here (How to update Kobold2D 2.1 project to MacOS10.10 / XCode 6.1?), I get a linker error that, despite all attempts (restarting, cleaning, deleting and adding frameworks) persists, and makes my project unstartable. I'm at my wit's end; this is a 3 year project, and I'm hitting a brick wall... The XCode 6.1 linker error reads as such:

Ld /Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Products/Debug-iphonesimulator/OME.app/OME normal i386
    cd /Users/fabian/Kobold2D/Kobold2D-2.1.0/OME
    export IPHONEOS_DEPLOYMENT_TARGET=7.1
    export 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/iPhoneSimulator8.1.sdk -L/Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Products/Debug-iphonesimulator -F/Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Products/Debug-iphonesimulator -filelist /Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Intermediates/OME.build/Debug-iphonesimulator/OME-iOS.build/Objects-normal/i386/OME.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -lz -framework Foundation -framework AudioToolbox -framework OpenAL -framework QuartzCore -framework SystemConfiguration -framework AVFoundation -framework CoreGraphics -framework CoreLocation -framework MediaPlayer -framework OpenGLES -force_load /Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Products/Debug-iphonesimulator/libkobold2d-ios.a -force_load /Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Products/Debug-iphonesimulator/libcocos2d-ios.a -weak_framework CoreMotion -weak_framework GameKit -weak_framework iAd -weak_framework MessageUI -weak_framework StoreKit -weak_framework UIKit -weak-lSystem -lstdc++ -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework AudioToolbox -framework AVFoundation -framework CoreFoundation -framework GameKit -lbox2d-ios -lchipmunk-ios -lchipmunk-spacemanager-ios -lcocos2d-extensions-ios -lcocos2d-ios -lcocos3d-ios -lcocosdenshion-ios -lkobold2d-ios -lobjectal-ios -lsneakyinput-ios -lwax-ios -Xlinker -dependency_info -Xlinker /Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Intermediates/OME.build/Debug-iphonesimulator/OME-iOS.build/Objects-normal/i386/OME_dependency_info.dat -o /Users/fabian/Library/Developer/Xcode/DerivedData/OME-abspfkzbpimdpqaoclhujzvtfred/Build/Products/Debug-iphonesimulator/OME.app/OME

Undefined symbols for architecture i386:
  "___isnan", referenced from:
      -[OALGainAction prepareWithTarget:] in libobjectal-ios.a(OALAudioActions.o)
      -[OALPitchAction prepareWithTarget:] in libobjectal-ios.a(OALAudioActions.o)
      -[OALPanAction prepareWithTarget:] in libobjectal-ios.a(OALAudioActions.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

PLEASE pretty please: Does anybody have an idea? I might not understand enough about the possible cause here to proceed on my own. FWIW, libobjectal-ios.a has been removed and re-added to the project repeatedly, to no avail.


回答1:


Thanks to @LearnCocos2D' (Steffen's) response, I figured out how to fix this:

-Go into Kobold2D-Libraries >> ObjectAL >> ObjectAL >> Actions >> OALAudioActions.m

-In the source code of OALAudioAuctions.m, replace the 3 occurrences of "isnan" with "thisisnan" (There are 3 occurrences, OALGainAction, OALPitchAction and OALPanAction, in prepareWithTarget respectively)

-Then insert the following block at the top after Line 32:

#pragma mark x64 compatibility
#if TARGET_IPHONE_SIMULATOR
#define thisisnan(x)                                                  \
( x != x ? true : false)
#else
#define thisisnan(x)                                                  \
(isnan(x))
#endif


来源:https://stackoverflow.com/questions/26917172/how-to-fix-oalaudio-library-for-xcode-6-kobold2d-linker-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!