How to compile on multiple cores using mingw inside QTCreator

后端 未结 7 1211
被撕碎了的回忆
被撕碎了的回忆 2020-12-29 22:54

I have a quad-core i7 CPU on my windows desktop. I am trying to get mingw32-make to compile using as many core as possible. I have added -j8 into the \"Make Arguments\" fiel

7条回答
  •  独厮守ぢ
    2020-12-29 23:33

    -j8 probably isn't working because of a limitation in GNU Make on Win32.

    Try putting just -j into the make arguments field. That tells Make to spawn as many compile processes as it can--if you have enough RAM and CPU to handle that, it should be faster than a single compile.

    Unfortunately these are the only two options (without modifying the Makefiles): either -j1, or unlimited -j

    Full details: GNU Make on Win32 doesn't support the job server, so a parent Make process can't track the number of compile processes spawned by any sub-Make's. To be safe, the sub-Make's only run with -j1. I believe qmake/Qt Creator's generated Makefiles use multiple layers of Makefiles. I first figured out this issue with Microchip's MPLAB X IDE, check out this thread for more info

    This quote is from README.W32 distributed with GNU Make

    Support for parallel builds

    Parallel builds (-jN) are supported in this port, with 2 limitations:

    • The number of concurrent processes has a hard limit of 64, due to the way this port implements waiting for its subprocesses;

    • The job server method (available when Make runs on Posix platforms) is not supported, which means you must pass an explicit -jN switch to sub-Make's in a recursive Makefile. If a sub-Make does not receive an explicit -jN switch, it will default to -j1, i.e. no parallelism in sub-Make's.

提交回复
热议问题