[英]How do I determine the correct header files when building gcc from source files (libstdc++-v3 build)
我是從源文件構建gcc的新手。 我正在為此QNX構建一個交叉編譯器版本。
該過程的一部分是使用有關QNX版本的信息和一些路徑信息來修改build_hooks。
我正要構建libstdc ++-v3的過程中。 交叉編譯器運行良好,可用於構建libstdc ++源。
它會一直運行直到開始包含頭文件(例如math.h)。 具體來說,它正在構建complex_io.c。 它包括cmath,它執行#include_next“ math.h”
此時,出現許多功能錯誤的重新定義,例如:
In file included from /home/parallels/qnx-core-dev-tools/core-dev-tools/tools/gcc/branches/gcc_8_2_branch/linux-x86-o-ntox86/i486-pc-nto-qnx6.6.0/libstdc++-v3/include/complex:44,
from ../../../../../libstdc++-v3/src/c++98/complex_io.cc:25:
/home/parallels/qnx-core-dev-tools/core-dev-tools/tools/gcc/branches/gcc_8_2_branch/linux-x86-o-ntox86/i486-pc-nto-qnx6.6.0/libstdc++-v3/include/cmath:80:3: error: redefinition of 'double std::abs(double)'
abs(double __x)
^~~
In file included from /home/parallels/qnx-core-dev-tools/core-dev-tools/tools/gcc/branches/gcc_8_2_branch/linux-x86-o-ntox86/i486-pc-nto-qnx6.6.0/libstdc++-v3/include/cmath:36,
from /home/parallels/qnx-core-dev-tools/core-dev-tools/tools/gcc/branches/gcc_8_2_branch/linux-x86-o-ntox86/i486-pc-nto-qnx6.6.0/libstdc++-v3/include/complex:44,
from ../../../../../libstdc++-v3/src/c++98/complex_io.cc:25:
/opt/qnx660/target/qnx6/usr/include/math.h:720:15: note: 'double std::abs(double)' previously defined here
inline double abs(double _Left) // OVERLOADS
^~~
交叉編譯器的構建導致包含指向QNX(/ opt / qnx660 / target / qnx6 / usr / include)頭文件基本安裝的搜索路徑,因此,當cmath執行#include_next“ math.h”時,即為數學運算。 h包含在此目錄路徑中。
我想了解的是libstdc ++-v3的源代碼樹中正確的math.h在哪里? 有幾種可供選擇,到目前為止,我一直沒有選擇正確的方法。
./fixincludes/tests/base/ansi/math.h
./fixincludes/tests/base/architecture/ppc/math.h
./fixincludes/tests/base/math.h
./libstdc++-v3/include/tr1/math.h
./libstdc++-v3/include/c_compatibility/math.h
./linux-x86-o-ntox86/i486-pc-nto-qnx6.6.0/libstdc++-v3/include/tr1/math.h
./linux-x86-o-ntox86/i486-pc-nto-qnx6.6.0/pic/libstdc++-v3/include/tr1/math.h
即使我知道哪一個是正確的,我也不確定如何配置該構建,以便它選擇正確的math.h而不用破解任何自動生成的Makefile。
想法?
謝謝凱文
目的是C ++編譯器可以使用C編譯器提供的(或與之一起使用的)系統math.h
文件。 但是,似乎math.h
本身在std
名稱空間中具有一些C ++樣式的位(基於// OVERLOADS
注釋),並且混淆了libstdc ++的實現。
您需要查看您math.h
副本的定義。 也許有一個預處理器選項可用於禁用這些C ++定義。 然后,您可以在#include_next
指令之前進行設置。 或者,因為您的math.h
標頭顯然已經啟用了C ++,所以可能可以從libstdc++-v3/include/c/cmath
刪除abs
和modf
函數的定義。
考慮到這些問題,我預計將需要更多的移植工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.