【问题标题】:Cmake : /bigobj: No such file or directory [duplicate]Cmake:/ bigobj:没有这样的文件或目录[重复]
【发布时间】:2021-12-22 11:03:18
【问题描述】:

当我构建一个使用 Assimp 的应用程序时,我遇到了一个错误

C:\Users\nitin\AppData\Local\Temp\ccA4Vs3q.s: Assembler messages:
C:\Users\nitin\AppData\Local\Temp\ccA4Vs3q.s: Fatal error: can't write 117 bytes to section .text of CMakeFiles\assimp.dir\AssetLib\IFC\IFCReaderGen1_2x3.cpp.obj because: 'File too big'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/as.exe: CMakeFiles\assimp.dir\AssetLib\IFC\IFCReaderGen1_2x3.cpp.obj: too many sections (46774)
C:\Users\nitin\AppData\Local\Temp\ccA4Vs3q.s: Fatal error: can't close CMakeFiles\assimp.dir\AssetLib\IFC\IFCReaderGen1_2x3.cpp.obj: File too big
Nade\vendor\assimp\code\CMakeFiles\assimp.dir\build.make:1965: recipe for target 'Nade/vendor/assimp/code/CMakeFiles/assimp.dir/AssetLib/IFC/IFCReaderGen1_2x3.cpp.obj' failed

于是我在网上搜索了解决方案,发现一个解决方案说我需要设置/bigobj标志。

我正在使用 Cmake 和 Mingw32-make。

但是当我像这样添加定义时

set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} /bigobj)

或者那样

add_definitions(/bigobj)

我得到错误

/bigobj: No such file or directory

如何在解决Too Big OBJ file错误的同时解决这个错误?

【问题讨论】:

  • 以正斜杠 (/) 开头的选项通常用于 Windows。在 Unix 环境中(MinGW 也使用类 Unix 环境)选项通常以破折号前缀 (-) 传递。所以/bigobj绝对不适合作为MinGW下编译器的选项。请显示(添加到问题帖子中)关于“OBJ 文件太大”的确切错误消息。

标签: c++ cmake assimp


【解决方案1】:

8/bigobj 选项用于 Microsoft Visual Studio 编译器。

对于 GCC,请改用 -Wa,-mbig-obj

如果你想同时支持,试试:

if (MSVC)
  add_definitions(/bigobj)
else ()
  add_definitions(-Wa,-mbig-obj)
endif ()

【讨论】:

  • 有错别字,add_definition应该是add_definitions
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-23
  • 2021-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多