Page 1 of 1

Why my app can't compile if wxWidgets built with disable-debug

Posted: Mon Jun 10, 2019 2:57 pm
by Parduz
I've made two different folders for wxWidgets, one with debug enabled, and one not, then i configured and make (without install) the widgets.

Here the path and the configure of each one:

with enabled-debug:

Code: Select all

/home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/
../configure --disable-shared --enable-debug --with-gtk=2 --with-libtiff=no --with-opengl=no --enable-unicode
make
with disabled-debug

Code: Select all

/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/
../configure --disable-shared --disable-debug --with-gtk=2 --with-libtiff=no --with-opengl=no --enable-unicode
make

With Code::Blocks, for my app i've set two build methods (using GCC 6.3).
The one that link to the debug enabled compiles, the one that links to the debug disabled no, starting from this error

Code: Select all

obj/Debug/src/CommManager.o: in function "wxPostEvent(wxEvtHandler*, wxEvent const&)":
/home/fc/wxWidgets/wxWidgets-3.0.4/include/wx/event.h:3815: undefined reference to "wxTheAssertHandler"
and going on and on with a lot of undefined references to wxOnAssert, wxTrapInAssert, wxTrap, and so on.



Could someone tells me why?




Following are the log of the two compile commands for the two different "versions":

with --enabled-debug
enabled-debug wrote: -------------- Clean: Debug i386-Debug in MSXPG (compiler: GNU GCC i386 per wxWidgets 3.0.4)---------------

Cleaned "MSXPG - Debug i386-Debug"

-------------- Build: Debug i386-Debug in MSXPG (compiler: GNU GCC i386 per wxWidgets 3.0.4)---------------

g++ -Og -g -pthread -D__WXDEBUG__ -pthread -std=gnu++11 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/wx/include/gtk2-unicode-static-3.0 -I/home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386 -I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include -I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include/wx/charts -I/home/fc/wxWidgets/wxWidgets-3.0.4/include -c /home/fc/MSXPG/MSXPG/src/<MANY FILES.cpp> -o obj/DebugD/src/<MANY FILES.o>
...
g++ -L/home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/wx/include/gtk2-unicode-static-3.0 -L/home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386 -L/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include -L/home/fc/wxWidgets/wxWidgets-3.0.4/include -o bin/DebugD/MSXPG obj/DebugD/src/<MANY FILES.o>
...
-pthread -lgthread-2.0 -lX11 -lXxf86vm -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lpng -lexpat -lwxregexu-3.0 -lwxjpeg-3.0 -lz -ldl -lm ../WXCHARTS/libwxchartsbetad.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_baseu_net-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_xrc-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_adv-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_propgrid-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_ribbon-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_richtext-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_stc-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_baseu_xml-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwxregexu-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwxscintilla-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_aui-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_html-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_gtk2u_core-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwxjpeg-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/lib/libwx_baseu-3.0.a

/home/fc/MSXPG/MSXPG/src/fMainForm.cpp: In constructor ‘fMainForm::fMainForm(wxWindow*, wxWindowID, const wxString&, const wxPoint&, const wxSize&, long int)’:
/home/fc/MSXPG/MSXPG/src/fMainForm.cpp:18:1: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
fMainForm::fMainForm(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
^~~~~~~~~

Output file is bin/DebugD/MSXPG with size 61.74 MB
Process terminated with status 0 (2 minute(s), 24 second(s))
0 error(s), 5 warning(s) (2 minute(s), 24 second(s))
with --disabled-debug
disabled-debug wrote:
-------------- Clean: Debug i386 in MSXPG (compiler: GNU GCC i386 per wxWidgets 3.0.4)---------------

Cleaned "MSXPG - Debug i386"

-------------- Build: Debug i386 in MSXPG (compiler: GNU GCC i386 per wxWidgets 3.0.4)---------------

g++ -Og -g -pthread -pthread -std=gnu++11 -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/wx/include/gtk2-unicode-static-3.0 -I/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib -I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include -I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include/wx/charts -I/home/fc/wxWidgets/wxWidgets-3.0.4/include -c /home/fc/MSXPG/MSXPG/src/<MANY FILES.cpp> -o obj/Debug/src/<MANY FILES.o>
...
g++ -L/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/wx/include/gtk2-unicode-static-3.0 -L/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib -L/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include -L/home/fc/wxWidgets/wxWidgets-3.0.4/include -o bin/Debug/MSXPG obj/Debug/src//<MANY FILES.o>
...

-pthread -lgthread-2.0 -lX11 -lXxf86vm -lSM -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lpng -lexpat -lwxregexu-3.0 -lwxjpeg-3.0 -lz -ldl -lm ../WXCHARTS/libwxchartsbetad.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_baseu_net-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_xrc-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_adv-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_propgrid-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_ribbon-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_richtext-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_stc-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_baseu_xml-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwxregexu-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwxscintilla-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_aui-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_html-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_gtk2u_core-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwxjpeg-3.0.a /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/lib/libwx_baseu-3.0.a
/home/fc/MSXPG/MSXPG/src/fMainForm.cpp: In constructor ‘fMainForm::fMainForm(wxWindow*, wxWindowID, const wxString&, const wxPoint&, const wxSize&, long int)’:
/home/fc/MSXPG/MSXPG/src/fMainForm.cpp:18:1: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
fMainForm::fMainForm(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
^~~~~~~~~

obj/Debug/src/CommManager.o: nella funzione "wxPostEvent(wxEvtHandler*, wxEvent const&)":
/home/fc/wxWidgets/wxWidgets-3.0.4/include/wx/event.h:3815: riferimento non definito a "wxTheAssertHandler"
/home/fc/wxWidgets/wxWidgets-3.0.4/include/wx/event.h:3815: riferimento non definito a "wxOnAssert(char const*, int, char const*, char const*, char const*)"
/home/fc/wxWidgets/wxWidgets-3.0.4/include/wx/event.h:3815: riferimento non definito a "wxTrapInAssert"
/home/fc/wxWidgets/wxWidgets-3.0.4/include/wx/event.h:3815: riferimento non definito a "wxTrapInAssert"
/home/fc/wxWidgets/wxWidgets-3.0.4/include/wx/event.h:3815: riferimento non definito a "wxTrap()"

Re: Why my app can't compile if wxWidgets built with disable-debug

Posted: Mon Jun 10, 2019 4:20 pm
by Manolo
I think you should review the link directories you set in C::B for different targets. And likely the include dirs also.

Re: Why my app can't compile if wxWidgets built with disable-debug

Posted: Tue Jun 11, 2019 12:28 pm
by Parduz
Manolo wrote:
Mon Jun 10, 2019 4:20 pm
I think you should review the link directories you set in C::B for different targets. And likely the include dirs also.
Well, other than the two differents wx build directories, and the __WXDEBUG__ define, there's no difference in the two g++ calls :?
compile using debug-enabled wxWidgets wrote: g++
-Og
-g
-D__WXDEBUG__
-pthread
-std=gnu++11
-D_FILE_OFFSET_BITS=64
-D__WXGTK__
-I/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-d/lib/wx/include/gtk2-unicode-static-3.0
-I/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-d/lib
-I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include
-I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include/wx/charts
-I/home/fc/wxWidgets/wxWidgets-3.0.4/include
-c /home/fc/MSXPG/MSXPG/src/cKeyboard.cpp
-o obj/DebugD/src/cKeyboard.o

...

g++
-L/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-d/lib/wx/include/gtk2-unicode-static-3.0
-L/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-d/lib
-L/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include
-L/home/fc/wxWidgets/wxWidgets-3.0.4/include
-o bin/DebugD/MSXPG
obj/DebugD/src/cKeyboard.o

...
-pthread
-lgthread-2.0
-lX11
-lXxf86vm
-lSM
-lgtk-x11-2.0
-lgdk-x11-2.0
-lpangocairo-1.0
-latk-1.0
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lpangoft2-1.0
-lpango-1.0
-lgobject-2.0
-lglib-2.0
-lfontconfig
-lfreetype
-lpng
-lexpat
-lwxregexu-3.0
-lwxjpeg-3.0
-lz
-ldl
-lm /home/fc/MSXPG/WXCHARTS/libwxchartsbeta_d.a
-lwx_baseu_net-3.0
-lwx_gtk2u_xrc-3.0
-lwx_gtk2u_adv-3.0
-lwx_gtk2u_propgrid-3.0
-lwx_gtk2u_ribbon-3.0
-lwx_gtk2u_richtext-3.0
-lwx_gtk2u_stc-3.0
-lwx_baseu_xml-3.0
-lwxregexu-3.0
-lwxscintilla-3.0
-lwx_gtk2u_aui-3.0
-lwx_gtk2u_html-3.0
-lwx_gtk2u_core-3.0
-lwxjpeg-3.0
-lwxpng-3.0
-lwx_baseu-3.0
compile using debug-disabled wxWidgets wrote: g++
-Og
-g

-pthread
-std=gnu++11
-D_FILE_OFFSET_BITS=64
-D__WXGTK__
-I/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-r/lib/wx/include/gtk2-unicode-static-3.0
-I/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-r/lib
-I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include
-I/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include/wx/charts
-I/home/fc/wxWidgets/wxWidgets-3.0.4/include
-c /home/fc/MSXPG/MSXPG/src/cKeyboard.cpp
-o obj/DebugR/src/cKeyboard.o

...

g++
-L/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-r/lib/wx/include/gtk2-unicode-static-3.0
-L/home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-686-r/lib
-L/home/fc/MSXPG/WXCHARTS/wxCharts_BetaLibrary/include
-L/home/fc/wxWidgets/wxWidgets-3.0.4/include
-o bin/DebugR/MSXPG
obj/DebugR/src/cKeyboard.o
...
-pthread
-lgthread-2.0
-lX11
-lXxf86vm
-lSM
-lgtk-x11-2.0
-lgdk-x11-2.0
-lpangocairo-1.0
-latk-1.0
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lpangoft2-1.0
-lpango-1.0
-lgobject-2.0
-lglib-2.0
-lfontconfig
-lfreetype
-lpng
-lexpat
-lwxregexu-3.0
-lwxjpeg-3.0
-lz
-ldl
-lm /home/fc/MSXPG/WXCHARTS/libwxchartsbeta_r.a
-lwx_baseu_net-3.0
-lwx_gtk2u_xrc-3.0
-lwx_gtk2u_adv-3.0
-lwx_gtk2u_propgrid-3.0
-lwx_gtk2u_ribbon-3.0
-lwx_gtk2u_richtext-3.0
-lwx_gtk2u_stc-3.0
-lwx_baseu_xml-3.0
-lwxregexu-3.0
-lwxscintilla-3.0
-lwx_gtk2u_aui-3.0
-lwx_gtk2u_html-3.0
-lwx_gtk2u_core-3.0
-lwxjpeg-3.0
-lwxpng-3.0
-lwx_baseu-3.0

Re: Why my app can't compile if wxWidgets built with disable-debug

Posted: Tue Jun 11, 2019 3:26 pm
by Manolo
Take a slow look at yourwxBuilDir/samples/minimal/Makefile. It defines a var wx_top_builddir and another top_srcdir = ../../..
top_srcdir is "yourwxMainDir" = /home/fc/wxWidgets/wxWidgets-3.0.4 in your case.

You have two different wx builds (I called 'yourwxBuilDir')
/home/fc/wxWidgets/wxWidgets-3.0.4/build-debug-GTK2-i386/ and /home/fc/wxWidgets/wxWidgets-3.0.4/build-GTK2-i386/

As you can see in the minimal/Makefile not only you must tell the linker where to find the libs (-LyourwxBuilDir/lib), but also it needs two "includes" (-I, i-uppercase flag), one as yourwxMainDir/include, so it can find the wx headers, and one as yourwxBuilDir/ib/wx/include/gtkXXXX, so it can find the "setup.h" used at wx building.

You have to use the proper directories in each of your targets. Seems you have mixed them.
The yourwxMainDir/include dir is the same for all targets. The 'wx_top_builddir' is specific for each target.

Re: Why my app can't compile if wxWidgets built with disable-debug

Posted: Wed Jun 12, 2019 10:57 am
by Parduz
Well, i cleaned up my compiler/linker search paths, but in the end what did the trick was adding
wxDEBUG_LEVEL=0
as #define for everything compiled using the --disable-debug build.

Noticed that flag while compiling the minimal sample.

Thanks.