[英]Build Assimp with Cygwin
我想使用 cmake 和 cygwin 構建 Assimp。
根據 cmake 文檔,cmake 有 7 個 Makefile 發生器:
Borland Makefiles
MSYS Makefiles
MinGW Makefiles
NMake Makefiles
NMake Makefiles JOM
Unix Makefiles
Watcom WMake
但是沒有任何用於 cygwin 的 Makefile 生成器。
如何使用 cygwin 構建 Assimp?
在 cygwin 上構建, strcasecmp
存在問題
/pub/tmp/assimp-5.0.1/include/assimp/StringComparison.h:146:14: error: ‘::strcasecmp’ has not been declared; did you mean ‘strncmp’?
146 | return ::strcasecmp(s1,s2);
| ^~~~~~~~~~
| strncmp
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html
這是由於 Cygwin 仍將其視為擴展
第二個問題來自復雜的 C++ 模板
[ 37%] Building CXX object code/CMakeFiles/assimp.dir/Importer/IFC/IFCReaderGen1_2x3.cpp.o
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/as: CMakeFiles/assimp.dir/Importer/IFC/IFCReaderGen1_2x3.cpp.o: too many sections (88485)
/tmp/cc95KPdy.s: Assembler messages:
/tmp/cc95KPdy.s: Fatal error: can't write 180 bytes to section .text of CMakeFiles/assimp.dir/Importer/IFC/IFCReaderGen1_2x3.cpp.o: 'file too big'
我們可以從以下方面獲取解決方案:
https://digitalkarabela.com/mingw-w64-how-to-fix-file-too-big-too-many-sections/
第三個問題是
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/as: CMakeFiles/assimp.dir/Importer/StepFile/StepFileGen1.cpp.o: section .xdata$_ZNSt11_Tuple_implILm1EJSt14default_deleteIN6Assimp8StepFile31draughting_callout_relationshipEEEE7_M_headERS5_: string table overflow at offset 10000005
/tmp/ccNl78l4.s: Assembler messages:
/tmp/ccNl78l4.s: Fatal error: can't close CMakeFiles/assimp.dir/Importer/StepFile/StepFileGen1.cpp.o: file too big
以及使用 -O1 的建議
gcc 編譯時字符串表溢出錯誤
作品。
有了它們,我們可以:
tar -xf assimp-5.0.1.tar.gz
cd assimp-5.0.1
cmake -DCMAKE_CXX_FLAGS="-D_GNU_SOURCE -Wa,-mbig-obj -O1" -DCMAKE_C_FLAGS="-D_GNU_SOURCE -Wa,-mbig-obj -O1" .
make
最后
....
[100%] Linking CXX executable ../bin/unit.exe
[100%] Built target unit
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.