Search code examples
wxwidgets

wxWidgets library build garbled file name in linker


On attempting to build wxWidgets 3.1.0 libraries, I am getting this error

ar: gcc_mswu\moolib_fontmap.o: No such file or directory

A file does exists with a slightly different spelling

 Directory of C:\Users\James\code\wxwidgets-3.1.0\build\msw\gcc_mswu

2017-01-05  02:01 PM            98,886 monolib_fontmap.o

It looks like a typo in the makefile, or like a letter is missed reading the makefile. Is that possible?

Except: if I redirect the console output to a file and open in an editor , the correct spelling shows up:

enter image description here

So the correct command is going to the linker, but the linker is looking for a garbled filename!

Here is the complete recipe for what I am doing:

Download wxWidgets source code from https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.0/wxWidgets-3.1.0.7z

Unpack to a folder. On my system, I use C:\Users\James\code\wxwidgets-3.1.0

Open a command window.

cd to the code::blocks mingw folder. On my system this is C:\Program Files (x86)\CodeBlocks16\MinGW

Type mingwvars.bat

cd to wxwidgets folder. On my system C:\Users\James\code\wxwidgets-3.1.0

cd to ./build/msw

Type mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1 SHARED=0 MONOLITHIC=1

Solution

  • This seems to be the same problem as the one mentioned in the wiki. Apparently there is a bug in mingw32-make with very long command lines which makes it (sometimes?) eat characters in them...

    Yes. Applying the recipe in the link you posted fixed the problem. Here are the details:

    modify makefile.gcc as following:

    From:

    ifeq ($(MONOLITHIC),1)
    ifeq ($(SHARED),0)
    $(LIBDIRNAME)\libwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).a: $(MONOLIB_OBJECTS)
        if exist $@ del $@
        ar rcu $@ $(MONOLIB_OBJECTS)
        ranlib $@
    endif
    endif
    

    Replace second occurence of $(MONOLIB_OBJECTS) with gcc_mswu\monolib*.o:

    ifeq ($(MONOLITHIC),1)
    ifeq ($(SHARED),0)
    $(LIBDIRNAME)\libwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).a: $(MONOLIB_OBJECTS)
        if exist $@ del $@
        ar rcu $@ gcc_mswu\\monolib*.o
        ranlib $@
    endif
    endif