使用MinGW的-j(jobs)选项构建wxWidgets时出错 [英] Error building wxWidgets using -j (jobs) option with MinGW
问题描述
我正在使用以下命令行为Windows编译WxWidgets:
I'm compiling WxWidgets for Windows using the following command line:
mingw32-make -f makefile.gcc BUILD=release SHARED=1 -j6
最后一个参数(-j
)用于通过运行并行执行多个作业,在我的情况下,它充分利用了我的6核处理器.单线程构建通常需要很长的时间.
The last parameter (-j
) is used to speed up the compilation by running multiple jobs in parallel, in my case making full use of my 6-core processor. A single-threaded build normally takes very long.
但是,当我按下Enter键时,我得到以下输出:
However, I get the following output when hitting Enter:
if not exist gcc_mswudll mkdir gcc_mswudll
if not exist ..\..\lib\gcc_dll mkdir ..\..\lib\gcc_dll
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
gcc -c -o gcc_mswudll\wxregex_regcomp.o -O2 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\msw
u -D__WXMSW__ -D_UNICODE -MTgcc_mswudll\wxregex_regcomp.o -MFgcc_mswudll\wxregex_regcomp.o.d -MD -MP ../../src/regex/
regcomp.c
The system can not find the path specified.
0 file(s) copied.
makefile.gcc:5651: recipe for target '..\..\lib\gcc_dll\mswu\wx\setup.h' failed
mingw32-make: *** [..\..\lib\gcc_dll\mswu\wx\setup.h] Error 1
mingw32-make: *** Waiting for unfinished jobs....
In file included from ..\..\include/wx/defs.h:27:0,
from ../../src/regex/regcustom.h:39,
from ../../src/regex/regguts.h:38,
from ../../src/regex/regcomp.c:33:
..\..\include/wx/platform.h:183:22: fatal error: wx/setup.h: No such file or directory
#include "wx/setup.h"
^
compilation terminated.
makefile.gcc:5702: recipe for target 'gcc_mswudll\wxregex_regcomp.o' failed
mingw32-make: *** [gcc_mswudll\wxregex_regcomp.o] Error 1
然后,如果我第二次重复相同的命令,则会显示以下输出:
Then, if I just repeat the same command a second time, the following output is shown:
if not exist ..\..\lib\gcc_dll\mswu mkdir ..\..\lib\gcc_dll\mswu
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
gcc -c -o gcc_mswudll\wxregex_regcomp.o -O2 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\msw
u -D__WXMSW__ -D_UNICODE -MTgcc_mswudll\wxregex_regcomp.o -MFgcc_mswudll\wxregex_regcomp.o.d -MD -MP ../../src/regex/
regcompThe system can not find the path specified.
.c
0 file(s) copied.
makefile.gcc:5651: recipe for target '..\..\lib\gcc_dll\mswu\wx\setup.h' failed
mingw32-make: *** [..\..\lib\gcc_dll\mswu\wx\setup.h] Error 1
mingw32-make: *** Waiting for unfinished jobs....
In file included from ..\..\include/wx/defs.h:27:0,
from ../../src/regex/regcustom.h:39,
from ../../src/regex/regguts.h:38,
from ../../src/regex/regcomp.c:33:
..\..\include/wx/platform.h:183:22: fatal error: wx/setup.h: No such file or directory
#include "wx/setup.h"
^
compilation terminated.
makefile.gcc:5702: recipe for target 'gcc_mswudll\wxregex_regcomp.o' failed
mingw32-make: *** [gcc_mswudll\wxregex_regcomp.o] Error 1
然后...如果我第三次尝试,编译成功完成.
Then... If I try a third time, the compilation finishes successfully.
问题:是否可以按照以下步骤并行构建WxWidgets,或者以后使用编译的二进制文件时是否有可能导致问题?
Question: Is it ok to follow this procedure to build WxWidgets in parallel, or is there a possibility that it will lead to problems when using the compiled binaries later on?
推荐答案
不幸的是,MSW makefile中确实存在一个错误,缺少对setup_h
目标的各种库的依赖.首先执行make setup_h
然后执行make -jN
应该是安全的.
Unfortunately there is indeed a bug in MSW makefiles with missing dependencies of the various libraries on setup_h
target. It should be safe to do make setup_h
first and then make -jN
.
或者,您可以按照此旧但仍然有效的发布,那么make -jN
的效果就很好.
Alternatively, you could build using configure as explained in this old but still valid post, then just make -jN
works perfectly fine.
这篇关于使用MinGW的-j(jobs)选项构建wxWidgets时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!