2014-11-16 20 views
14

我詢問這樣一個共同的問題表示歉意;我無法找到任何可行的解決方案或足夠清晰的解決方案來實施。我只是試圖安裝mgiza。這裏是INSTALL文件:另一個「LD:符號(S)沒有發現建築x86_64的」問題與提升,此時用mgiza

cmake . 
make 
make install 

If you want to install to a custom location, add the following flag when you run cmake: 
-DCMAKE_INSTALL_PREFIX=/path/to/custom/location 

NOTE: Boost Version 1.48 has problem with the code, you can use either 1.46 or 1.50+. Unfortunately 1.48 is shipped with Ubuntu 12.04 LTS, you can either download and compile libboost 1.50+ from their website, or just do this: 
sudo apt-get install libboost1.46-all-dev 

看起來很簡單吧?在cmake .中輸入沒有任何明顯問題。不幸的是,make運行到這個可怕的錯誤(「未定義的符號...」)與提升。

1 warning generated. 
Linking CXX executable ../bin/d4norm 
Undefined symbols for architecture x86_64: 
    "std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from: 
     boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o) 
    "std::string::_Rep::_S_empty_rep_storage", referenced from: 
     boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o) 
    "std::string::assign(char const*, unsigned long)", referenced from: 
     boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o) 
    "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from: 
     boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o) 
    "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from: 
     boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o) 
    "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from: 
     boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system-mt.a(error_code.o) 
ld: symbol(s) not found for architecture x86_64 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

基於其他的問題,它與小牛隊的一個問題,因爲它使用鐺編譯C++代碼,這意味着該庫的libC++,不是的libstdC++。爲了完整性,以便其他人可以重現我的錯誤,我使用的是OS X 10.9.5,Xcode 6.1,我的升級版本是1.56(升壓是通過自制軟件安裝的)。

現在,必須有一些修復在那裏,對不對?讓我們通過一些:

  1. Applying the -m32 flag:不適用,因爲Makefile文件 不具有任何的「g ++」,也明確地告訴我,不要 編輯它,因爲它是一個「CMake的」生成的文件。
  2. Not defining something in a header file:不適用,因爲代碼應該準備好編譯。
  3. Adding -stdlib=libstdc++ to linker:我不知道如何將它添加到一個make命令?我試過只是做make -stdlib=libstdc++,雖然這似乎避免了上述錯誤,但它引入了一些額外的錯誤:make: *** [all] Error 2(不知道這意味着什麼)。
  4. Linking to proper boost libraries:有評論那裏,說:「你只需要鏈接到正確的Boost庫...大量的Q /關於如何做到這一點。」不幸的是,我不認爲這些評論者提出的任何問題都可以解決我的問題。
  5. Linking Qt with boost:我不認爲,因爲我沒有使用Qt,這是適用的,我不知道我會放在一個LIBS += [...] boost線。
  6. Linking a missing file:這個問題似乎更多地關於運行g++時的鏈接,但我使用的Makefile在其中的任何位置都沒有g++
  7. Using g++ vs gcc:我不知道我怎樣才能改變我使用的這些,因爲我使用cmakemake ...
  8. Changing a link command:同樣,我不知道我怎麼能編譯從改變cmake/makegcc。 (注:從這點上來說,我會忽略由添加一些與gcc或g ++回答最多的問題。)
  9. Changing the standard c++ library:該解決方案包括進入Xcode和改變圖書館那裏。我不認爲這是正確的方法,無論如何,如果我改變了Xcode中的設置(我對Xcode的GUI沒有經驗),我可能會搞砸了一些東西。
  10. Linking libraries in Xcode:我覺得這個列表與第9個類似。這裏的答案也建議使用自制軟件而不是macports來安裝boost,但我之前已經說過我使用自制軟件來安裝boost。
  11. Compile with clang:類似的問題,但我如何獲得cmake或使用clang編譯?
  12. From a (popular) bitcoin issue:現在這個看起來有趣!大量的人遇到了我的錯誤。不幸的是,似乎沒有共識或簡單的解決方案。還有一些我不知道要實施的解決方案。例如,「imbolo」的一個解決方案是使用cxxflag標誌來編譯boost,但這意味着什麼?

所以我就如何正確安裝mgiza虧損一點點......我的意思是,mgiza的給我cmakemake整點是讓我有擔心編譯事情的混亂細節,對吧?但這不僅僅是一個mgiza問題,因爲我在其他地方嘗試make時遇到了這個問題。我理解(C)Makefiles的高級思想,但不瞭解低級細節。

+0

試'cmake的-DCMAKE_C_COMPILER =鐺-DCMAKE_CXX_COMPILER =鐺++ .' – zaufi

+0

謝謝,而似乎強制使用鐺鐺和++的,我最終得到這個錯誤以下'make':/ bin/sh的:$ HOME/mgiza/mgizapp/clang ++:沒有這樣的文件或目錄。它恰好在開始make之後就發生了。 – ComputerScientist

+0

然後,嘗試絕對路徑叮噹編譯器(不知道它實際位於OSX) – zaufi

回答

2

爲了解決評論者的一些問題:處理這個問題的最好方法是儘可能地嘗試清理你的系統,並從頭開始這個過程。另外,自從發佈了這個版本之後,OS X 10.10 Yosemite發佈了,它可能解決了這個問題(IIRC這個問題主要是由於10.9和clang/gcc編譯器的改變)。

相關問題