Seven Wang Seven Wang - 2 months ago 18
iOS Question

command line debug build project Undefined symbols for architecture i386

Running

xcodebuild -target szapp
returns:

CONFIGURATION_BUILD_DIR=$/Users/szmall/Documents/new12/trunk/head/ShiZu -configuration Debug build -sdk iphonesimulator9.2 ONLY_ACTIVE_ARCH=NO VALID_ARCHS='arm64 armv7s armv7 i386'
build my project have this error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_QQApiAudioObject", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_QQApiImageObject", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_QQApiInterface", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_QQApiNewsObject", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_QQApiTextObject", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_QQApiVideoObject", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_SendMessageToQQReq", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
"_OBJC_CLASS_$_TencentOAuth", referenced from:
objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


but libSocialQQ.a exist on Link Binary With Libraries.

And use xcode run my project can build success. Please help me,Thanks!

Answer

Remove i386 from Target's Build Settings -> Architectures -> Valid Architectures, there is no need to specify it. But if your library does not contain code for i386 - you will have problems trying to run it on older simulators.

BTW, you can check supported architectures using command lipo -info libSocialQQ.a.

Comments