2011-10-31 57 views
19

我一直在搜索SO和Google,但還沒有找到有用的東西。架構i386的未定義符號將項目升級到iOS 5

我們將更新現有的iOS項目,以建立針對iOS的5

我們的項目有兩個目標,第一個是我們的靜態庫,第二個是一個單元測試應用程序(GHUnit)。

在構建單元測試的目標是成功編譯靜態庫,但隨後沒有針對它與下面的輸出鏈接:

Ld /Users/XXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXLibrary-egoqfplddstqvwaigwuiqfqplcax/Build/Products/Debug-iphonesimulator/UnitTests.app/UnitTests normal i386 
    cd /Users/XXXXXX/Documents/iOS/trunk 
    setenv MACOSX_DEPLOYMENT_TARGET 10.6 
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/XXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXLibrary-egoqfplddstqvwaigwuiqfqplcax/Build/Products/Debug-iphonesimulator -F/Users/XXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXLibrary-egoqfplddstqvwaigwuiqfqplcax/Build/Products/Debug-iphonesimulator -F/Users/XXXXXX/Documents/iOS/trunk -F/Users/XXXXXX/Documents/iOS/trunk/UnitTests -filelist /Users/XXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXLibrary-egoqfplddstqvwaigwuiqfqplcax/Build/Intermediates/XXXXXXLibrary.build/Debug-iphonesimulator/UnitTests.build/Objects-normal/i386/UnitTests.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load -Wl -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework SystemConfiguration -framework CoreLocation -framework CoreData /Users/XXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXLibrary-egoqfplddstqvwaigwuiqfqplcax/Build/Products/Debug-iphonesimulator/XXXXXX.a -framework GHUnitIOS -framework CoreGraphics -framework Foundation -framework UIKit -o /Users/XXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXLibrary-egoqfplddstqvwaigwuiqfqplcax/Build/Products/Debug-iphonesimulator/UnitTests.app/UnitTests 

    Undefined symbols for architecture i386: 
     "_llvm_gcda_start_file", referenced from: 
      ___llvm_gcov_writeout in XXXXXX.a(NSObject+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(NSString+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonBase.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonParser.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonWriter.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXXReachability.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXX.o) 
      ... 
     "_llvm_gcda_emit_function", referenced from: 
      ___llvm_gcov_writeout in XXXXXX.a(NSObject+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(NSString+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonBase.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonParser.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonWriter.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXXReachability.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXX.o) 
      ... 
     "_llvm_gcda_emit_arcs", referenced from: 
      ___llvm_gcov_writeout in XXXXXX.a(NSObject+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(NSString+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonBase.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonParser.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonWriter.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXXReachability.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXX.o) 
      ... 
     "_llvm_gcda_end_file", referenced from: 
      ___llvm_gcov_writeout in XXXXXX.a(NSObject+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(NSString+SBJSON.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonBase.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonParser.o) 
      ___llvm_gcov_writeout in XXXXXX.a(SBJsonWriter.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXXReachability.o) 
      ___llvm_gcov_writeout in XXXXXX.a(XXXXXX.o) 
      ... 
     "_llvm_gcda_increment_indirect_counter", referenced from: 
      -[SBJsonParser scanValue:] in XXXXXX.a(SBJsonParser.o) 
      -[SBJsonParser scanRestOfString:] in XXXXXX.a(SBJsonParser.o) 
      -[SBJsonWriter appendString:into:] in XXXXXX.a(SBJsonWriter.o) 
      -[XXXXXX loginSuccessfulCallback:XXXXXXHttpResult:] in XXXXXX.a(XXXXXX.o) 
      +[XXXXXXDataTank sharedDataTankManager] in XXXXXX.a(XXXXXXDataTank.o) 
      -[XXXXXXDataTank processFiveHundredSeriesHttpResult:] in XXXXXX.a(XXXXXXDataTank.o) 
      -[XXXXXXDataTank networkActive] in XXXXXX.a(XXXXXXDataTank.o) 
      ... 
    ld: symbol(s) not found for architecture i386 
    clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我試圖尋找的unfound符號,但谷歌從字面上有0結果。

我假設靜態庫正在建立與單元測試目標不是,但我無法找到它的東西。

有沒有人有任何建議?

乾杯

+1

此錯誤通常在框架不可用時出現。在這裏我不確定哪個框架丟失,但也許你可以嘗試找出丟失的框架。 – Sahil

回答

4

llvm_gcda_start_file和共同被LLVM編譯器代碼覆蓋和單元測試溶液。

將-lprofile_rt添加到鏈接器項目設置中的標誌應解決此錯誤。 (較老的教程可能會提示-lgcov用於Xcode 3和GCC)

根據Code Coverage on Xcode 4.4.1「-lprofile_rt」不再需要。

+1

我有同樣的問題,並且將-lprofile_rt添加到鏈接程序標誌,但是導致了這個錯誤: '找不到-lprofile_rt的庫' –

+0

沒有用Xcode 4.3beta嘗試,但是在我的4.2版本中工作,只是嘗試: 1)檢查是否存在的話: '/usr/lib/libprofile_rt.a /usr/lib/libprofile_rt.dylib /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/libprofile_rt.a /開發人員/ Platforms/iPhoneOS.platform/Developer/usr/lib/libprofile_rt.dylib' 2)檢查你的項目設置是否有正確的路徑等... –

13

如果您不需要代碼覆蓋率,則可以使用以下設置完成禁用它,從而避免嘗試調用這些函數。

GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO 
GCC_GENERATE_TEST_COVERAGE_FILES = NO 
+0

這是我的修復。我曾經(不成功)在某一時刻設置了gcov,這個問題神祕地出現了。 –

+0

這是正確的答案。 – Jessedc

+0

如果你禁用了這個,那麼你可能需要重新編譯這個lib。 –

1

在我的情況下,我正在爲設備建設。切換到模擬器的工作就像魅力,但我不知道爲什麼它是不同的。 :-)

48

這個工作對我很好(趕上大膽的設置):

enter image description here

+9

「儀表程序流程」是我的問題!謝謝! –

+1

Yap,在我的情況下,它修復了[Google Analytics iOS SDK 3.x](https://developers.google.com/analytics/devguides/collection/ios/v3/)問題。 – Geri

+1

Thx!還需要'儀器程序流程' – Papasmile

-2

我有同樣的錯誤:只需添加「libGoogleAnalyticsServices.a」到你的文件

+4

Google Analytics與LLVM和gcov有什麼關係? – MdaG

相關問題