2015-09-29 35 views
0

我在我的Ubuntu Linux系統上從源碼上構建並安裝了llvm/clang-3.7(我從源碼構建,因爲我的開發環境在工作中沒有apt-get available )。 gcc版本是4.8.2。我按照http://clang.llvm.org/get_started.html的clang構建說明操作,並且一切正常(mkdir build; cd build; cmake -G「Unix Makefiles」../llvm; make; make install)。但是,我現在發現測試Block_copy的程序無法編譯。當我嘗試構建gnustep-base時,該程序是由autoconf自動生成的。失敗的部分是:Linux上的源碼鏗鏘-3.7找不到Block_copy

int 
main() 
{ 
    return _Block_copy(); 
    ; 
return 0; 
} 

我的編譯命令是:

clang -o conftest -m64 -march=opteron -mno-3dnow -ggdb -O2 -Wall -I/home/build/GNUstep/Local/Library/Headers -I/home/build/GNUstep/Local/Library/Headers -I/home/build/GNUstep/System/Library/Headers -fgnu-runtime -x objective-c -m64 -L/home/build/GNUstep/Local/Library/Libraries -L/home/build/GNUstep/Local/Library/Libraries -L/home/build/GNUstep/System/Library/Libraries conftest.c -lrt -ldl -lpthread -rdynamic -m64 -fgnu-runtime -L/home/build/GNUstep/Library/Libraries -L/home/build/GNUstep/Local/Library/Libraries -L/home/build/GNUstep/System/Library/Libraries -lobjc -lm 

我需要建立鐺一個特殊的選項來啓用塊,或者我應該與其他庫鏈接?

回答

1

我需要建立鐺一個特殊的選項來啓用塊

號但是你可以使用鐺二進制需要-fblocks選項。

-fblocks 
    Enable the "Blocks" language feature. 

我應該與其他庫鏈接?

AFAIK,是的。

_Block_copy是BlocksRuntime的一部分。

你編譯編譯-RT?它包括BlocksRuntime。 The document解釋瞭如何構建編譯器rt。

+0

謝謝!事實證明,clang不再在默認情況下在Linux上構建BlocksRuntime,但可以破解cmake makefiles來請求它。我現在正在看。另外,事實證明,我甚至不需要clang提供的塊支持,因爲它是內置在libobjc2中的,我正在與之鏈接。 :) –