wx-config gives wrong include path

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
rainer66
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu May 17, 2007 9:38 am

wx-config gives wrong include path

Post by rainer66 » Fri Oct 23, 2020 7:37 pm

I compiled wxWidgets successfully on a SUSE system. Also the examples.

But compiling my example I have a little problem.

I tried to use wx-config for the getting the compiler settings.

wx-config --cflags returns:
-I/home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/lib64/wx/include/gtk2-unicode-3.1 -I/home/rainer/Downloads/wxWidgets-3.1.4/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread

wx-config --libs returns:
-L/home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/lib64 -pthread -Wl,-rpath,/home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/lib64 -lwx_gtk2u_xrc-3.1 -lwx_gtk2u_html-3.1 -lwx_gtk2u_qa-3.1 -lwx_gtk2u_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1

Both calls of wx-config contain in return value lib64. With this values the compiling failed. Changing lib64 to lib will fix the problem.

I thing there is a bug in wx-config, isn't? What do you thing about?

Regards
Rainer

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4540
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wx-config gives wrong include path

Post by ONEEYEMAN » Fri Oct 23, 2020 7:53 pm

Hi,
What was the exact configure command you used?

Thank you.

rainer66
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu May 17, 2007 9:38 am

Re: wx-config gives wrong include path

Post by rainer66 » Fri Oct 23, 2020 8:02 pm

../configure --with-gtk

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4540
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wx-config gives wrong include path

Post by ONEEYEMAN » Fri Oct 23, 2020 8:07 pm

Hi,
You didn't set any C{XX}/LD-FLAFS?

BTW, you should be using "wx-config -cxxflags" for c++ code, and not "wx-config --cflags". This will give more accurate values as cxxflags is for c++, while cflags is for c code.

Also, what command is executed while building wx samples and your code?

And I presume you are running wxWidgets 3.1.4, right?

Thank you.

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wx-config gives wrong include path

Post by DavidHart » Fri Oct 23, 2020 8:20 pm

Hi,
I compiled wxWidgets successfully on a SUSE system
Which suse version? And anything unusual about your system e.g. not AMD64?
../configure --with-gtk
Was that the whole configure line? IIUC you are using the build 'in situ', not installing it to /usr/* If that's true, the usual minimal configure line would be:
../configure --with-gtk --prefix=$(pwd)
Then
make -j$(nproc)
There's no need to 'make install'.
I suggest you try that in a different build dir, and see if the problem disappears.

Regards,

David

rainer66
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu May 17, 2007 9:38 am

Re: wx-config gives wrong include path

Post by rainer66 » Fri Oct 23, 2020 9:05 pm

Above command was the originally one.

Meanwhile I used ../configure --with-gtk --disable-shared. So the rest of the answers concern to that.

To your questions:
1) Yes, I use wxWidgets version 3.1.4
2) Yes, I build 'in-situ'. I build it again in the same directory with additional option -disable-shared
3) My SUSE verson is tumbleweed, version 20201022
4) My system has an INTEL processer. But the linux system is running in a VM.
5) make of example minimal(starting from the build directory)
cd samples/minimal
make

Output:
/home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/bk-deps g++ -c -o minimal_minimal.o -D_FILE_OFFSET_BITS=64 -I/home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/lib/wx/include/gtk2-unicode-static-3.1 -I../../../include -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/uuid -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0 -pthread -D__WXGTK__ -I../../../samples/minimal -I../../../samples/minimal/../../samples -pthread -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -O2 -I/usr/include/freetype2 -I/usr/include/uuid -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0 ../../../samples/minimal/minimal.cpp
g++ -o minimal minimal_minimal.o -L/home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/lib -pthread -lwx_gtk2u_core-3.1 -lwx_baseu-3.1 -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 -lharfbuzz -lfontconfig -lfreetype -lgthread-2.0 -pthread -lglib-2.0 -lX11 -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 -lharfbuzz -lfontconfig -lfreetype -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lpng -lz -ljpeg -ltiff -llzma -lwxregexu-3.1 -pthread -lz -ldl -llzma -lm -lz -ldl -llzma -lm
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: warning: libjpeg.so.8, needed by /usr/lib64/gcc/x86_64-suse-linux/10/../../../../lib64/libtiff.so, may conflict with libjpeg.so.62
6) make of my project
[goto project]
make

Output:
mkdir -p DEBUG/dep
creating dependencies for src/MainFrame.cpp
g++ -g3 -O1 -ggdb -fstack-check -Wall -Wformat=2 -Wno-long-long -Wextra -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wcast-align -Wconversion -Wlogical-op -Wmissing-declarations -Wredundant-decls -Wvla -Wvolatile-register-var -Wunused -pedantic -Wuninitialized -Wreturn-type -I src -Wnon-virtual-dtor -Wold-style-cast -DCPLUSPLUS -I../RH-C++/src -std=c++2a -I/home/rainer/Dokumente/eclipse-workspace/wxWidgets/build_gtk/lib64/wx/include/gtk2-unicode-3.1 -I/home/rainer/Dokumente/eclipse-workspace/wxWidgets/include -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -MM -MT "DEBUG/dep/MainFrame.d DEBUG/obj/MainFrame.o" -MF DEBUG/dep/MainFrame.d src/MainFrame.cpp
In Datei, eingebunden von /home/rainer/Dokumente/eclipse-workspace/wxWidgets/include/wx/defs.h:45,
von /home/rainer/Dokumente/eclipse-workspace/wxWidgets/include/wx/wxprec.h:12,
von src/MainFrame.h:5,
von src/MainFrame.cpp:2:
/home/rainer/Dokumente/eclipse-workspace/wxWidgets/include/wx/platform.h:160:10: schwerwiegender Fehler: wx/setup.h: Datei oder Verzeichnis nicht gefunden
160 | #include "wx/setup.h"
| ^~~~~~~~~~~~
Kompilierung beendet.
make: *** [../makefiles/rules.mk:77: DEBUG/dep/MainFrame.d] Fehler 1
Finally: When I change lib64 to lib in the include path compiling will work!

Thanks
Rainer

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4540
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wx-config gives wrong include path

Post by ONEEYEMAN » Fri Oct 23, 2020 9:28 pm

Hi,
Something is a miss here
wxWidgets is compiled in a release mode, while you application is using debug mode.

Are you trying to compile by hand?
Please make sure you use an appropriate wx-config version with --cxxflags/--libs options.

Check that you have only one wx-config on the system and it is used here.

Thank you.

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wx-config gives wrong include path

Post by DavidHart » Fri Oct 23, 2020 9:50 pm

Meanwhile I used ../configure --with-gtk --disable-shared. So the rest of the answers concern to that.
New in wx3.1.4, --with-gtk defaults to a gtk3 build, not gtk2. For a gtk2 build you would have needed to do --with-gtk=2

And did you try adding --prefix=$(pwd) ?

Edit: I've now built wx3.1.4 in a VirtualBox Leap 15.2, using your configure line plus --prefix, and I see what you mean:

Code: Select all

./wx-config --cxxflags
-I/home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/wx/include/gtk3-unicode-static-3.1 -I/home/david/devel/temp/wxWidgets-3.1.4/include -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread

/wx-config --libs
-L/home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64 -pthread   /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_gtk3u_xrc-3.1.a /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_gtk3u_qa-3.1.a /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_baseu_net-3.1.a /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_gtk3u_html-3.1.a /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_gtk3u_core-3.1.a /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_baseu_xml-3.1.a /home/david/devel/temp/wxWidgets-3.1.4/build-gtk/lib64/libwx_baseu-3.1.a -lgthread-2.0 -pthread -lX11 -lSM -lgtk-3 -lgdk-3 -lpangocairo-1.0 -latk-1.0 -lcairo-gobject -lcairo -lnotify -lgdk_pixbuf-2.0 -lXtst -lpangoft2-1.0 -lpango-1.0 -lharfbuzz -lfontconfig -lfreetype -lwxregexu-3.1 -lwxscintilla-3.1 -lexpat -lpng -ljpeg -ltiff -lz -ldl -lsecret-1 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -llzma -lm 
That shouldn't happen, of course...

DavidHart
Site Admin
Site Admin
Posts: 4008
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wx-config gives wrong include path

Post by DavidHart » Mon Oct 26, 2020 11:56 am

I thing there is a bug in wx-config, isn't? What do you thing about?
I was thinking that it is. If so, it's been there forever, but only became an issue when some distros started using lib64.

However I've now found that, if you 'make install', another subdir is created (in your case if would be /home/rainer/Downloads/wxWidgets-3.1.4/build_gtk/lib64/) with everything inside; now the wx-config calls do work correctly.

So IMO it isn't a bug. OTOH I've always told people that --prefix= builds don't need a 'make install'. I'm going to stop doing that.

Post Reply