【问题标题】:Build Assimp with Cygwin使用 Cygwin 构建 Assimp
【发布时间】:2021-04-11 03:42:35
【问题描述】:

我想使用 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 有自己的 cmake 包。你试过了吗?
  • 是的,我试过 cygwin cmake
  • 结果是?

标签: build compilation cygwin assimp


【解决方案1】:

在 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

以及来自
gcc string table overflow error during compilation

的使用 -O1 的建议

有效。
有了它们,我们可以:

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

【讨论】:

  • 我用cygwin成功编译了Assimp,谢谢。
  • 我听不懂你?
  • @user3552351 按答案左侧的绿色复选标记将您的问题标记为已解决。
猜你喜欢
  • 2021-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多