Unable to build my C++ project with jom. qmake problem?

111 Views Asked by At

I am using qtcreator to compile a large c++ project, the OS is windows, the compiler is visual studio.

There is an option in qtcreator to compile with jom instead of nmake, when it is activated the build of my project is 10 times faster.

jom

I was used to compile this project in release mode with jom, but from weeks it doesn't work anymore. However I can still compile in debug mode with jom or in release mode with nmake.

When I use jom in release build, I get a same error multiple time : C1041 multiple cl.exe write to the same .pdb file. Use /FS

When I look in qt compile output, the commands which seem to create these errors are similar to this :

cl -c -wd4100 -wd4244 -wd4068 -wd4267 -utf-8 /we4715 -O2 -Zi -MD -EHsc -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 /FdC:/Users/fgodi/Desktop/release/lib64/boost_components.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DNDEBUG -D_REENTRANT -DHAVE_EIGEN -DEIGEN_DONT_PARALLELIZE -DHAVE_HDF5 -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_USE_DECLSPECS_FOR_SAL -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -D_SECURE_SCL=0 -D_ITERATOR_DEBUG_LEVEL=0 -DNDEBUG -DARCH_SSE2 -DBOOST_THREAD_PROVIDES_FUTURE -DBOOST_THREAD_VERSION=4 -DBOOST_THREAD_BUILD_LIB -DQT_QML_DEBUG -IC:\Users\fgodi\Desktop\release\src\boost -I. -IC:\Users\fgodi\Desktop\release\src\boost -IC:/Users/fgodi/Desktop/release/src/boost/.libs/boost/libs/math/src/tr1 -IC:\Users\fgodi\Desktop\release\src -IC:\Users\fgodi\Desktop\release\src\boost -IC:\Users\fgodi\Desktop\release\include -IC:\Users\fgodi\Desktop\release\src\eigen -IC:\Users\fgodi\Desktop\release\include\hdf5 -IC:\Qt\5.13.2\msvc2017_64\mkspecs\win32-msvc -Fobuild-msvc-64-release\ @C:\Users\fgodi\AppData\Local\Temp\global_resource.obj.9152.219.jom 
global_resource.cpp
  1. I would like to add /FS in this command but I do not know where this command comes from, most of these options do not come from the .pro. If I add "OPTFLAGS += /FS" in the main .pro of the project, it doesn't change anything. Should I add "OPTFLAGS += /FS" in any .pro ?
  2. I am not even sure it will solve the problem because, for some reason, I can't just paste the command into command line and try to add the /FS to it. There are other errors when I try to do this, I added cl to my path but some other context is probably needed.
  3. I don't understand why suddenly I need this /FS while I have been compiling this project for months before without any problem.
1

There are 1 best solutions below

0
sixtyten On

You likely need /FS due to /Zi. There are two things you can try, either should work:

  • specify QMAKE_CXXFLAGS *= /FS. Put it in your global compiler settings include, if you have one (tends to be a .pri file). Also, I have never seen OPTFLAGS used in the way you describe, only QMAKE_CXXFLAGS. Also, including it in just the main .pro won't do very much, as you observed.
  • get rid of /Zi. I haven't seen your .pro file but I assume you've included that flag from somewhere - it's generally not a default in release builds.

Additional info: Your problem is a simple concurrency issue that arises in multithreaded builds. Sometimes you get lucky with your project structure and have no problems, but eventually you will get them.

Also a tip: Check the generated Makefile.Release for the compiler command line, this is usually quicker than trying to glean it from the compile log.