buildwxwidgetsmingw32msw

WxWidgets - Error in build with mingw32-exe dll, mingw64


I am trying to build WxWidgets 3.2.4 with MinGW64 g++ from the cmd line. After downloading the source, I followed the build instructions ("...\docs\mswinstall.md"), which state:

### Using makefiles from Windows command line

The `makefile.gcc` makefiles are for compilation using MinGW using Windows
command interpreter (`cmd.exe`), they will *not* work if you use Unix
shell, as is the case with MSYS. Follow the instructions for using configure
above instead if you prefer to use Unix shell. The commands shown here must be
executed from a DOS command line window (cmd.exe, *not* Bash sh.exe).

1. Change directory to `%%WXWIN%\build\msw` and type

        > mingw32-make -f makefile.gcc

   to build wxWidgets in the default debug configuration as a static
   library. Add "BUILD=release" and/or "SHARED=1" to build the library
   in release configuration and/or as a shared library instead of the
   default static one, see [Make Parameters](#msw_build_make_params)
   for more details.

I get a quite long output (reported later in the message) in the cmd line, which ends in:

if exist ..\..\lib\gcc_dll\libwxregexu.a del ..\..\lib\gcc_dll\libwxregexu.a

ar rcu ..\..\lib\gcc_dll\libwxregexu.a @..\..\lib\gcc_dll\libwxregexu.a.rsp

ar: file "@../../lib/gcc_dll/libwxregexu.a.rsp": The system cannot find the path specified.

mingw32-make: *** [makefile.gcc:5364: ..\..\lib\gcc_dll\libwxregexu.a] Error 1

The build command I ran is:

C:\SwDev\WxWidgets\v_3.2.4\build\msw>%MINGW64_v13_2_0_r1%\mingw32-make -f makefile.gcc BUILD=release SHARED=1

where the environment variable MINGW64_v13_2_0_r1 points to the MinGW64 folder ("C:\SwDev\MinGW_w64\Ver_13.2.0_Rev_1\mingw64\bin").

In "makefile.gcc", the line which reports the error (line 5364) is as follows:

5360 $(LIBDIRNAME)\libwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).a: $(WXREGEX_OBJECTS)
5361    $(foreach f,$(subst \,/,$(WXREGEX_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
5362    @move /y $@.rsp.tmp $@.rsp >nul
5363    if exist $@ del $@
5364    ar rcu $@ @$@.rsp
5365    @-del $@.rsp
5366    ranlib $@

The entire build message is:

C:\SwDev\WxWidgets\v_3.2.4\build\msw>%MINGW64_v13_2_0_r1%\mingw32-make -f makefile.gcc BUILD=release SHARED=1
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 mkdir ..\..\lib\gcc_dll\mswu
if not exist ..\..\lib\gcc_dll\mswu\wx mkdir ..\..\lib\gcc_dll\mswu\wx
if not exist ..\..\lib\gcc_dll\mswu\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_dll\mswu\wx\setup.h
        1 file(s) copied.
if not exist ..\..\lib\gcc_dll\mswu\wx\msw mkdir ..\..\lib\gcc_dll\mswu\wx\msw
gcc -E  "..\..\include\wx\msw\genrcdefs.h" > "..\..\lib\gcc_dll\mswu\wx\msw\rcdefs.h"
gcc -c -o gcc_mswudll\wxregex_pcre2_auto_possess.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_auto_possess.o -MFgcc_mswudll\wxregex_pcre2_auto_possess.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_auto_possess.c
gcc -c -o gcc_mswudll\wxregex_pcre2_compile.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_compile.o -MFgcc_mswudll\wxregex_pcre2_compile.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_compile.c
gcc -c -o gcc_mswudll\wxregex_pcre2_config.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_config.o -MFgcc_mswudll\wxregex_pcre2_config.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_config.c
gcc -c -o gcc_mswudll\wxregex_pcre2_context.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_context.o -MFgcc_mswudll\wxregex_pcre2_context.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_context.c
gcc -c -o gcc_mswudll\wxregex_pcre2_convert.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_convert.o -MFgcc_mswudll\wxregex_pcre2_convert.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_convert.c
gcc -c -o gcc_mswudll\wxregex_pcre2_dfa_match.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_dfa_match.o -MFgcc_mswudll\wxregex_pcre2_dfa_match.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_dfa_match.c
gcc -c -o gcc_mswudll\wxregex_pcre2_error.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_error.o -MFgcc_mswudll\wxregex_pcre2_error.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_error.c
gcc -c -o gcc_mswudll\wxregex_pcre2_extuni.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_extuni.o -MFgcc_mswudll\wxregex_pcre2_extuni.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_extuni.c
gcc -c -o gcc_mswudll\wxregex_pcre2_find_bracket.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_find_bracket.o -MFgcc_mswudll\wxregex_pcre2_find_bracket.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_find_bracket.c
gcc -c -o gcc_mswudll\wxregex_pcre2_jit_compile.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_jit_compile.o -MFgcc_mswudll\wxregex_pcre2_jit_compile.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_jit_compile.c
gcc -c -o gcc_mswudll\wxregex_pcre2_maketables.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_maketables.o -MFgcc_mswudll\wxregex_pcre2_maketables.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_maketables.c
gcc -c -o gcc_mswudll\wxregex_pcre2_match.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_match.o -MFgcc_mswudll\wxregex_pcre2_match.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_match.c
gcc -c -o gcc_mswudll\wxregex_pcre2_match_data.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_match_data.o -MFgcc_mswudll\wxregex_pcre2_match_data.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_match_data.c
gcc -c -o gcc_mswudll\wxregex_pcre2_newline.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_newline.o -MFgcc_mswudll\wxregex_pcre2_newline.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_newline.c
gcc -c -o gcc_mswudll\wxregex_pcre2_ord2utf.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_ord2utf.o -MFgcc_mswudll\wxregex_pcre2_ord2utf.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_ord2utf.c
gcc -c -o gcc_mswudll\wxregex_pcre2_pattern_info.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_pattern_info.o -MFgcc_mswudll\wxregex_pcre2_pattern_info.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_pattern_info.c
gcc -c -o gcc_mswudll\wxregex_pcre2_script_run.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_script_run.o -MFgcc_mswudll\wxregex_pcre2_script_run.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_script_run.c
gcc -c -o gcc_mswudll\wxregex_pcre2_serialize.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_serialize.o -MFgcc_mswudll\wxregex_pcre2_serialize.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_serialize.c
gcc -c -o gcc_mswudll\wxregex_pcre2_string_utils.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_string_utils.o -MFgcc_mswudll\wxregex_pcre2_string_utils.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_string_utils.c
gcc -c -o gcc_mswudll\wxregex_pcre2_study.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_study.o -MFgcc_mswudll\wxregex_pcre2_study.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_study.c
gcc -c -o gcc_mswudll\wxregex_pcre2_substitute.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_substitute.o -MFgcc_mswudll\wxregex_pcre2_substitute.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_substitute.c
gcc -c -o gcc_mswudll\wxregex_pcre2_substring.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_substring.o -MFgcc_mswudll\wxregex_pcre2_substring.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_substring.c
gcc -c -o gcc_mswudll\wxregex_pcre2_tables.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_tables.o -MFgcc_mswudll\wxregex_pcre2_tables.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_tables.c
gcc -c -o gcc_mswudll\wxregex_pcre2_ucd.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_ucd.o -MFgcc_mswudll\wxregex_pcre2_ucd.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_ucd.c
gcc -c -o gcc_mswudll\wxregex_pcre2_valid_utf.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_valid_utf.o -MFgcc_mswudll\wxregex_pcre2_valid_utf.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_valid_utf.c
gcc -c -o gcc_mswudll\wxregex_pcre2_xclass.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_xclass.o -MFgcc_mswudll\wxregex_pcre2_xclass.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_xclass.c
gcc -c -o gcc_mswudll\wxregex_pcre2_chartables.o  -O2 -mthreads -DNDEBUG -I..\..\include -I..\..\lib\gcc_dll\mswu -I..\..\3rdparty\pcre\src\wx -D__WX__ -DHAVE_CONFIG_H -D_UNICODE   -MTgcc_mswudll\wxregex_pcre2_chartables.o -MFgcc_mswudll\wxregex_pcre2_chartables.o.d -MD -MP ../../3rdparty/pcre/src/pcre2_chartables.c
if exist ..\..\lib\gcc_dll\libwxregexu.a del ..\..\lib\gcc_dll\libwxregexu.a
ar rcu ..\..\lib\gcc_dll\libwxregexu.a @..\..\lib\gcc_dll\libwxregexu.a.rsp
ar: file "@../../lib/gcc_dll/libwxregexu.a.rsp": The system cannot find the path specified.
mingw32-make: *** [makefile.gcc:5364: ..\..\lib\gcc_dll\libwxregexu.a] Error 1

I followed precisely the instructions, but I couldn't fix the issue. The MinGW64 has been downloaded from GitHub ("https://github.com/niXman/mingw-builds-binaries/releases"), and the the release is the 13.2.0-rev1:

C:\SwDev\WxWidgets\v_3.2.4\build\msw>%MINGW64_v13_2_0_r1%\g++ --version

g++ (x86_64-win32-seh-rev1, Built by MinGW-Builds project) 13.2.0

Copyright (C) 2023 Free Software Foundation, Inc.

I tried also with the version 12, but I got the same error.

When I move to search the path not found ("@../../lib/gcc_dll/libwxregexu.a.rsp"), it is present and located "...\lib\gcc_dll".

I don't have experience with building with make, and I cannot get the point from the output. I wonder if the issue comes from the compiler, but I can't find the means to understand it.

Did someone ever face this issue, or have suggestions/explainations about the problem?

Thanks in advance.


Solution

  • Issue found. I had multiple ar.exe, which were called in the failed build above (found writing

    where ar

    in the cmd line). Furthermore, they were different,easily visible by writing:

    ar -v

    To fix the problem, after opening cmd.exe, I set the path of the MinGW, then run the build as per instructions, as follows:

    C:>set PATH=C:\SwDev\MinGW\x64\v_13.2.0\mingw64\bin

    C:>echo %PATH%

    C:\SwDev\MinGW\x64\v_13.2.0\mingw64\bin

    C:>cd C:\SwDev\WxWidgets\v_3.2.4\build\msw

    C:\SwDev\WxWidgets\v_3.2.4\build\msw>mingw32-make -f makefile.gcc SHARED=1 BUILD=release

    In this way, it works properly.