2013-02-20 132 views
0

我想交叉編譯PowerPC架構的Boost庫(線程,系統)。我遵循下面的步驟,但面臨問題。PowerPC架構的交叉編譯Boost庫

我運行一個shell腳本來設置我的工具鏈。編譯器ppc_4xx-g ++在shell中可見。

步驟如下:

  1. 添加行 「用gcc:功率:ppc_4xx-G ++;」到文件user-config.jam
  2. 在根目錄下運行./bootstrap.sh --prefix = BoostPowerPC。
  3. 運行./b2安裝--build-DIR = BoostPowerPC工具包= GCC-功率--with線程--with系統級

結果:所有的目錄被創建,但編譯失敗。我無法附上錯誤日誌(請將您的電子郵件發送給我,以便我可以根據需要向您發送錯誤日誌)。以下是錯誤日誌的快照。

Component configuration: 

- atomic     : not building 
- chrono     : not building 
- context     : not building 
- date_time    : not building 
- exception    : not building 
- filesystem    : not building 
- graph     : not building 
- graph_parallel   : not building 
- iostreams    : not building 
- locale     : not building 
- math      : not building 
- mpi      : not building 
- program_options   : not building 
- python     : not building 
- random     : not building 
- regex     : not building 
- serialization   : not building 
- signals     : not building 
- system     : building 
- test      : not building 
- thread     : building 
- timer     : not building 
- wave      : not building 

...patience... 
...found 20376 targets... 
...updating 10110 targets... 
common.mkdir BoostPowerPC 
common.mkdir BoostPowerPC/lib 
common.mkdir BoostPowerPC/boost 
common.mkdir BoostPowerPC/boost/bin.v2 
common.mkdir BoostPowerPC/boost/bin.v2/libs 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release 
common.mkdir BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release/threading-multi 
gcc.compile.c++ BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release/threading-multi/error_code.o 
In file included from ./boost/config/select_stdlib_config.hpp:18, 
      from ./boost/config.hpp:40, 
      from ./boost/system/config.hpp:13, 
      from libs/system/src/error_code.cpp:18: 
/opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/cstddef:50:28: error: bits/c++config.h: No such file or directory 
In file included from /opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/ios:43, 
      from /opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/ostream:45, 
      from /opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/iterator:70, 
      from ./boost/iterator.hpp:17, 
      from ./boost/operators.hpp:86, 
      from ./boost/system/error_code.hpp:17, 
      from libs/system/src/error_code.cpp:19: 
. 
. 
. 

它抱怨找不到文件C++ config.h。但該文件存在於/opt/ELDK/4.2/usr/include/c++/4.2.2/powerpc-linux/bits目錄中

然後我嘗試在b2命令中使用標記「include」。但是後來我得到一個錯誤,即文件cstddef沒有找到,它出現在目錄/opt/ELDK/4.2/usr/include/c++/4.2.2中。我認爲我已經寫完了包含路徑。

您認爲是什麼問題?爲什麼我的編譯器找不到該文件,即使它存在?有什麼建議麼 ?

更新:

我用-d + 2和-q選項和下面是結果。

"ppc_4xx-g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_DYN_LINK=1 -DNDEBUG -I"." -I"/opt/ELDK/4.2/ppc_4xx/usr/include" -c -o "BoostPowerPC/boost/bin.v2/libs/system/build/gcc-power/release/threading-multi/error_code.o" "libs/system/src/error_code.cpp" 

編譯日誌:

In file included from ./boost/config/select_stdlib_config.hpp:18, 
      from ./boost/config.hpp:40, 
      from ./boost/system/config.hpp:13, 
      from libs/system/src/error_code.cpp:18: 
/opt/ELDK/4.2/ppc_4xx/usr/include/c++/4.2.2/cstddef:50:28: error: bits/c++config.h: No such file or directory 

正如我們可以看到包括在內,可見的編譯器,具有所需的文件更高的目錄。我甚至嘗試使用-L命令並指定根目錄。它仍然沒有幫助。

我檢查的ppc_4xx-g ++以及2個選項編譯選項我感興趣

  1. --sysroot =:這是所有包含和由編譯器使用的庫的根目錄。

  2. -B:使用這個我們可以爲編譯器添加一個搜索路徑。

我試過了,它沒有幫助。有什麼建議麼 ?

回答

0

問題出在編譯器中的一個錯誤。它無法遞歸搜索目錄以查找包含文件夾。當我手動提供額外的包含路徑時,它拒絕它說明多餘的包含路徑(因爲它位於相同的目錄結構中) - 通過使用-v選項找到了此路徑。然後我創建了一個目錄,創建了一個到具有必要包含文件的目錄的軟鏈接,並將此新目錄包含在我的包含路徑中(解決方法)。這工作,我可以生成庫。例如:包含文件存在於abc/include/xyz/include目錄中,編譯器不接受,因爲我已經指定了路徑abc/include。因此,我創建了一個目錄別名並將其鏈接到abc/include/xyz/include。然後,我將./alias作爲包含路徑之一,並且工作正常。這是一個已知的編譯器問題,它在後來的版本中得到修復,我認爲在4.6

PS:這個想法不是我的,但發現了一個類似的帖子在線幫助我。

+0

你有指向有問題的錯誤的指針嗎? – 2013-02-23 11:51:51

+0

@VladimirPrus:我沒有指向錯誤的指針,但是我從這個[post]中找到了解決方案(http://stackoverflow.com/questions/4643197/missing-include-bits-cconfig-h-when-交叉編譯-64位程序-32位) – Neo 2013-02-23 19:41:00

+0

謝謝。看起來像Ubuntu特定的錯誤。 – 2013-02-24 05:33:33

0

您的包含路徑不正確,並且錯誤清楚地表明瞭這一點,因爲每個工具鏈都有自己的路徑,請確保STL等包含路徑更新爲指向新位置。它應該解決你的問題!

+0

我發現我的問題的解決方案,檢查解決方案。謝謝你的幫助。 – Neo 2013-02-23 08:18:54

1

首先,這不是Boost.Build的問題。這意味着通過執行最後一條命令(失敗)可以更容易地修復它,在命令行上手動運行它,然後調整它直到它工作。

如前所述,您應該從命令行中刪除-I"/opt/ELDK/4.2/ppc_4xx/usr/include"

通常,編譯器應自動查找自己的頭文件。兩種可能的情況會干擾:

  1. 您正在從不同於實際安裝編譯器頭文件的位置運行ppc_4xx-g ++。用which ppc_4xx-g++搞清楚。您還可以將-v添加到編譯器調用中,以檢查它正在搜索哪些目錄。
  2. 編譯器以未知方式未正確構建。迂迴地說,'ppc_4xx'甚至不是有效的目標三元組,但我不知道這是否會按照你所描述的方式破壞編譯。

作爲最後的手段,你可以嘗試--sysroot=/opt/ELDK/4.2/ppc_4xx/usr/bin

+0

感謝您的意見,正如您所提到的那樣,它不是Boost的問題,我找到了問題併發布了答案。 – Neo 2013-02-23 08:18:04