2

I need to compile a C++ program on Windows using the CLion IDE with CMake and Qt Creator with QMake. On Linux, I do not get any problems at all. On Windows, I wanted to use the MinGW compiler. My source code relies on boost. Therefore, according to this question, I was installing the compiler from the MinGW Distro.

So far so good. Now, during the compilation process I get the following error:

c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles\[...]: too many sections (52187)
C:\Users\MATTHI~1\AppData\Local\Temp\cc2TyXHu.s: Assembler messages:
C:\Users\MATTHI~1\AppData\Local\Temp\cc2TyXHu.s: Fatal error: can't write 231 bytes to section .text of CMakeFiles\[...]: 'file too big'

after some research, (here and here) I found out that heavy templating might be the reason for this issue... However, I do not do any templating at all, but I'm including the Eigen libraries that might cause the issue.

In any case, I need to fix this and the proposed solution is to add the following flags to my compiler: -Wa,-mbig-obj.

My question now is: how can I do this in my IDE (CLion or QtCreator) or in my CMakeLists.txt (CMake) and/or myProject.pro (QMake) files?

user7431005
  • 3,899
  • 4
  • 22
  • 49
  • For cmake you could use the `target_compile_options()` command, but you should probably check, if the compiler used is one you know supports the options. – fabian Nov 25 '20 at 18:27
  • Did you find a solution since then? I have the exact same problem, on windows/CMake/QtCreator/Eigen – Autiwa Feb 08 '22 at 19:28

0 Answers0