I am trying to compile wxWidgets using MinGW, and am having problems. I will ultimately be using MinGW from within Code::Blocks, but for now, I am simply compiling using the command line because that's what all the examples I see online do.
The problem is: I am able to compile many, many wxWidgets files, but there are two files whose name or directory get mangled somehow during compilation, even though they appear correctly in the build file, and the build comes to a halt.
Here are the error messages and why they're wrong:
g++: error: gcc_mswuddll\monodll_clpickercmn.o: No such file or directory # the filename is missing an "r"; should be "monodll_clrpickercmn"
g++: error: gccmswuddll\monodll_xh_filectrl.o: No such file or directory # the directory is missing an underscore; should be "gcc_mswuddll"
I have looked at many similar problems with compiling wxWidgets on Stack Overflow and in the wxWidgets help forums, but none addresses this particular issue.
The software versions I'm using are: gcc: 4.9.3 wxWidgets: 3.0.2 Code::Blocks: 16.01 (I'm not using Code::Blocks yet, but when I do, this will be the version I use)
In my attempts to fix this problem, I have uninstalled wxWidgets, reinstalled it, and tried recompiling. I got the exact same issues with the exact same files.
I made a batch file to compile wxWidgets, and listed all the steps that I followed to compile wxWidgets in the batch file. I did all those steps already. If there's something else I'm supposed to do to make wxWidgets compile, I don't know it yet. Here is that batch file.
echo off
cls
rem ----------------------------------------------------------------------------
rem Compile wxWidgets
rem ----------------------------------------------------------------------------
rem
rem Edited by Colleen Kobe
rem March 23, 2016
rem
rem Description: This batch file gives you directions to follow to download
rem and compile wxWidgets, gcc, and Code::Blocks.
rem
rem These directions work on the following software versions:
rem
rem gcc: 4.9.3
rem wxWidgets: 3.0.2
rem Code::Blocks 16.01
rem
rem Note: I gathered the steps below from a number of
rem different web pages. No page listed all these steps.
rem That leads me to believe that there are a lot of different
rem errors that can happen during these installations. Many
rem of the "authorized" lists of instructions don't have these
rem errors. Why? Beats me.
rem
rem Directions. You must do the following tasks in order to compile
rem wxWidgets (and for this batch file to succeed).
rem
rem Most of this advice comes from
rem https://wiki.wxwidgets.org/Downloading_and_installing_wxWidgets and
rem https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW.
rem
rem 1. Download MinGW. See http://www.mingw.org/category/wiki/download.
rem See the additional documentation in F:\Documents\wxWidgets about
rem which options you'll need. I installed mine into C:\MinGW, so any
rem time I need to reference the MinGW directory, C:\MinGW's the
rem directory I'll use.
rem
rem 2. Download wxWidgets. See https://www.wxwidgets.org/downloads/.
rem Install it into a directory whose name constains NO BLANKS. I
rem installed mine into F:\wxWidgets F:\Documents\wxWidgets about which
rem options you'll need. I installed mine into F:\wxWidgets, and so any
rem time I need to reference the wxWidgets directory, F:\wxWidgets's the
rem directory I'll use.
rem
rem 3. Download Code::Blocks. See http://www.codeblocks.org/downloads/25.
rem
rem 4. Create an environment variable %WXWIN% and assign it the name of the
rem directory into which you installed wxWidgets. In my case, I'd assign
rem it the value F:\wxWidgets. See
rem https://kb.wisc.edu/cae/page.php?id=24500 for directions on creating
rem a system variable in Windows 7.
rem
rem 5. Append F:\wxWidgets and C:\MinGW\msys\1.0\bin to the system path.
rem See http://stackoverflow.com/questions/23400030/windows-7-add-path
rem for directions to change the path.
rem
rem 6. Still in the Control Panel: Make sure your system path does NOT
rem contain MSYS or CYGWIN directories. Delete those directories from
rem the path, if they're there.
rem
rem 7. Open %WXWIN%\build\msw\config.gcc. Find the string (without the
rem leading blanks):
rem
rem CXXFLAGS
rem
rem Change the line to read
rem
rem CXXFLAGS += "-std=gnu++11"
rem
rem Close config.gcc.
rem
rem 8. Open %WXWIN%\build\msw\makefile.gcc. Find the string (without the
rem leading blanks):
rem
rem ar rcu $@ $(MONOLIB_OBJECTS)
rem
rem There is only one line like it in the file. Replace that string with
rem
rem ~ar rcu $@ gcc_mswu\\monolib*.o
rem
rem EXCEPT replace the tilde (~) with a tab character (ASCII 0x09), and
rem the entire line should start in column 1.
rem
rem Close makefile.gcc.
rem
rem 9. You are now ready to run this batch file to compile wxWidgets.
rem First, be sure this batch file resides in %WXWIN%\build\msw. If it
rem doesn't, move it there.
rem
rem 10. Open a cmd.exe shell (click the Start button and type, in the
rem command box, cmd [Enter]. At the DOS command, type:
rem
rem cd F:\wxWidgets\build\msw
rem compilem
rem
rem Cross your fingers. Press the spacebar when prompted to. Hope like
rem crazy that it all passes.
rem
rem ----------------------------------------------------------------------------
echo on
set WXWIN=F:\wxWidgets
set origpath=%path%
F:
cd %WXWIN%\build\msw
rem ----------------------------------------------------------------------------
rem Clean up and build the debug version. Start by deleting the old files.
rem ----------------------------------------------------------------------------
erase /q F:\wxWidgets\build\msw\gcc_mswu\*.*
erase /q F:\wxWidgets\build\msw\gcc_mswuddll\*.*
erase /q F:\wxWidgets\build\msw\gcc_mswudll\*.*
rem ----------------------------------------------------------------------------
rem The "-j4" compiler option means use this many threads to compile. The
rem option works, but it makes debugging any error messages a little tricky. So
rem remove the option during debugging, but add it back in later.
rem ----------------------------------------------------------------------------
rem mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=debug UNICODE=1 SHARED=1 MONOLITHIC=1 clean
mingw32-make SHELL=CMD.exe -f makefile.gcc BUILD=debug UNICODE=1 SHARED=1 MONOLITHIC=1 clean
pause Debug File Clean complete. Ready to compile.
cls
rem mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=debug UNICODE=1 SHARED=1 MONOLITHIC=1
mingw32-make SHELL=CMD.exe -f makefile.gcc BUILD=debug UNICODE=1 SHARED=1 MONOLITHIC=1
rem ----------------------------------------------------------------------------
rem Clean up and build the release version. == wait to do this until the debug version works.
rem ----------------------------------------------------------------------------
rem mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1 clean
rem rem mingw32-make SHELL=CMD.exe -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1 clean
rem pause
rem cls
rem mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1
rem mingw32-make SHELL=CMD.exe -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1
rem ----------------------------------------------------------------------------
rem Have to do this copy manually--I don't know why.
rem ----------------------------------------------------------------------------
copy %WXWIN%\include\wx\msw\setup.h %WXWIN%\include\wx
Line 130 in the batch file runs makefile.gcc. Here are selected lines from the makefile (I didn't want to display the entire 16,335 lines):
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.9 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
include config.gcc
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
.
.
.
$(OBJS)\monodll_xh_editlbox.o \
$(OBJS)\monodll_xh_filectrl.o \
$(OBJS)\monodll_xh_filepicker.o \
.
.
.
$(OBJS)\monodll_clipcmn.o \
$(OBJS)\monodll_clrpickercmn.o \
$(OBJS)\monodll_colourcmn.o \
.
.
.
$(OBJS)\monodll_clipcmn.o \
$(OBJS)\monodll_clrpickercmn.o \
$(OBJS)\monodll_colourcmn.o \
.
.
.
$(OBJS)\monodll_xh_editlbox.o: ../../src/xrc/xh_editlbox.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_xh_filectrl.o: ../../src/xrc/xh_filectrl.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_xh_filepicker.o: ../../src/xrc/xh_filepicker.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
.
.
.
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_clipcmn.o: ../../src/common/clipcmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_clrpickercmn.o: ../../src/common/clrpickercmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_colourcmn.o: ../../src/common/colourcmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
.
.
.
When running compilem, here are the last 68 lines of output. The show-stopping error messages occur on lines 33 and 34.
ll_xh_chckb.o gcc_mswuddll\monodll_xh_chckl.o gcc_mswuddll\monodll_xh_choic.o gcc_mswuddll\monodll_xh_choicbk.o gcc_mswu
ddll\monodll_xh_clrpicker.o gcc_mswuddll\monodll_xh_cmdlinkbn.o gcc_mswuddll\monodll_xh_collpane.o gcc_mswuddll\monodll_
xh_combo.o gcc_mswuddll\monodll_xh_comboctrl.o gcc_mswuddll\monodll_xh_datectrl.o gcc_mswuddll\monodll_xh_dirpicker.o gc
c_mswuddll\monodll_xh_dlg.o gcc_mswuddll\monodll_xh_editlbox.o gcc_mswuddll\monodll_xh_filectrl.o gcc_mswuddll\monodll_x
h_filepicker.o gcc_mswuddll\monodll_xh_fontpicker.o gcc_mswuddll\monodll_xh_frame.o gcc_mswuddll\monodll_xh_gauge.o gcc_
mswuddll\monodll_xh_gdctl.o gcc_mswuddll\monodll_xh_grid.o gcc_mswuddll\monodll_xh_html.o gcc_mswuddll\monodll_xh_hyperl
ink.o gcc_mswuddll\monodll_xh_listb.o gcc_mswuddll\monodll_xh_listbk.o gcc_mswuddll\monodll_xh_listc.o gcc_mswuddll\mono
dll_xh_mdi.o gcc_mswuddll\monodll_xh_menu.o gcc_mswuddll\monodll_xh_notbk.o gcc_mswuddll\monodll_xh_odcombo.o gcc_mswudd
ll\monodll_xh_panel.o gcc_mswuddll\monodll_xh_propdlg.o gcc_mswuddll\monodll_xh_radbt.o gcc_mswuddll\monodll_xh_radbx.o
gcc_mswuddll\monodll_xh_scrol.o gcc_mswuddll\monodll_xh_scwin.o gcc_mswuddll\monodll_xh_htmllbox.o gcc_mswuddll\monodll_
xh_simplebook.o gcc_mswuddll\monodll_xh_sizer.o gcc_mswuddll\monodll_xh_slidr.o gcc_mswuddll\monodll_xh_spin.o gcc_mswud
dll\monodll_xh_split.o gcc_mswuddll\monodll_xh_srchctrl.o gcc_mswuddll\monodll_xh_statbar.o gcc_mswuddll\monodll_xh_stbm
p.o gcc_mswuddll\monodll_xh_stbox.o gcc_mswuddll\monodll_xh_stlin.o gcc_mswuddll\monodll_xh_sttxt.o gcc_mswuddll\monodll
_xh_text.o gcc_mswuddll\monodll_xh_tglbtn.o gcc_mswuddll\monodll_xh_timectrl.o gcc_mswuddll\monodll_xh_toolb.o gcc_mswud
dll\monodll_xh_toolbk.o gcc_mswuddll\monodll_xh_tree.o gcc_mswuddll\monodll_xh_treebk.o gcc_mswuddll\monodll_xh_unkwn.o
gcc_mswuddll\monodll_xh_wizrd.o gcc_mswuddll\monodll_xmlres.o gcc_mswuddll\monodll_xmladv.o gcc_mswuddll\monodll_xmlrsal
l.o gcc_mswuddll\monodll_framemanager.o gcc_mswuddll\monodll_dockart.o gcc_mswuddll\monodll_floatpane.o gcc_mswuddll\mon
odll_auibook.o gcc_mswuddll\monodll_auibar.o gcc_mswuddll\monodll_tabmdi.o gcc_mswuddll\monodll_tabart.o gcc_mswuddll\mo
nodll_xh_auinotbk.o gcc_mswuddll\monodll_advprops.o gcc_mswuddll\monodll_editors.o gcc_mswuddll\monodll_manager.o gcc_ms
wuddll\monodll_property.o gcc_mswuddll\monodll_propgrid.o gcc_mswuddll\monodll_propgridiface.o gcc_mswuddll\monodll_prop
gridpagestate.o gcc_mswuddll\monodll_props.o gcc_mswuddll\monodll_art_internal.o gcc_mswuddll\monodll_art_msw.o gcc_mswu
ddll\monodll_art_aui.o gcc_mswuddll\monodll_bar.o gcc_mswuddll\monodll_ribbon_buttonbar.o gcc_mswuddll\monodll_ribbon_co
ntrol.o gcc_mswuddll\monodll_gallery.o gcc_mswuddll\monodll_page.o gcc_mswuddll\monodll_ribbon_panel.o gcc_mswuddll\mono
dll_ribbon_toolbar.o gcc_mswuddll\monodll_xh_ribbon.o gcc_mswuddll\monodll_richtextbuffer.o gcc_mswuddll\monodll_richtex
tctrl.o gcc_mswuddll\monodll_richtextformatdlg.o gcc_mswuddll\monodll_richtexthtml.o gcc_mswuddll\monodll_richtextimaged
lg.o gcc_mswuddll\monodll_richtextprint.o gcc_mswuddll\monodll_richtextstyledlg.o gcc_mswuddll\monodll_richtextstyles.o
gcc_mswuddll\monodll_richtextsymboldlg.o gcc_mswuddll\monodll_richtextxml.o gcc_mswuddll\monodll_xh_richtext.o gcc_mswud
dll\monodll_stc.o gcc_mswuddll\monodll_PlatWX.o gcc_mswuddll\monodll_ScintillaWX.o gcc_mswuddll\monodll_xml.o gcc_mswudd
ll\monodll_xtixml.o gcc_mswuddll\monodll_version_rc.o -g -mthreads -L..\..\lib\gcc_dll -Wl,--out-implib=..\..\lib\gcc_d
ll\libwxmsw30ud.a -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lco
mdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwininet ..\
..\lib\gcc_dll\libwxscintillad.a
g++: error: gcc_mswuddll\monodll_clpickercmn.o: No such file or directory
g++: error: gccmswuddll\monodll_xh_filectrl.o: No such file or directory
makefile.gcc:5206: recipe for target '..\..\lib\gcc_dll\wxmsw30ud_gcc_custom.dll' failed
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw30ud_gcc_custom.dll] Error 1
F:\wxWidgets\build\msw>rem ----------------------------------------------------------------------------
F:\wxWidgets\build\msw>rem Clean up and build the release version. == wait to do this until the debug version works.
F:\wxWidgets\build\msw>rem ----------------------------------------------------------------------------
F:\wxWidgets\build\msw>rem mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHI
C=1 clean
F:\wxWidgets\build\msw>rem rem mingw32-make SHELL=CMD.exe -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHI
C=1 clean
F:\wxWidgets\build\msw>rem pause
F:\wxWidgets\build\msw>rem cls
F:\wxWidgets\build\msw>rem mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHI
C=1
F:\wxWidgets\build\msw>rem mingw32-make SHELL=CMD.exe -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1
F:\wxWidgets\build\msw>rem ----------------------------------------------------------------------------
F:\wxWidgets\build\msw>rem Have to do this copy manually--I don't know why.
F:\wxWidgets\build\msw>rem ----------------------------------------------------------------------------
F:\wxWidgets\build\msw>copy F:\wxWidgets\include\wx\msw\setup.h F:\wxWidgets\include\wx
1 file(s) copied.
F:\wxWidgets\build\msw>
For your information:
- F:\wxWidgets\build\msw\gcc_mswuddll\monodll_clrpickercmn.o does exist.
F:\wxWidgets\build\msw\gcc_mswuddll\monodll_clrpickercmn.o.d does exist.
F:\wxWidgets\build\msw\gcc_mswuddll\monodll_xh_filectrl.o.d does exist.
- F:\wxWidgets\build\msw\gcc_mswuddll\monodll_xh_filectrl.o does exist.
Out of all those files getting compiled, why are those two files, and JUST those two files, getting garbled? What's so special about them?
- Neither is the longest file name; \webviewdll_webviewarchivehandler.o is longest.
- Neither is the shortest file name; \wxpng_png.o is shorter.
https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW addresses the issue "No such file or directory," but I already implemented their suggestion with changing the MONOLIB_OBJECTS line, and I'm still getting this error.
Where do I go from here? How do I fix this? Suggestions?