Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

Then I ran it again selecting the last option.
4 /usr/lib/arm-linux-gnueabihf/wx/config/gtk2-unicode-release-2.8 288 manual mode
That selected a wx2.8 build. I suggest you do it again and select 0 (or 3, it's the same one) to get the wx3.0 build.

However I'm surprised about:
main.cpp:12:19: fatal error: wx/wx.h: No such file or directory
The 2.8 build does have one :/

Try again after selecting the wx3.0 build. First check the result of wx-config --cxxflags and --libs in the terminal you're going to use. You should have wx3 results, and no mention of /usr/local/. If you do get a /usr/local/ build, check your PATH with
echo $PATH
If that has /usr/local/bin before /usr/bin you need either to remove the wx build there or, less drastic, do:
PATH=/usr/bin:$PATH
in the terminal you're using to build your program.
Code from here on (in this post) is from my PC which is playing nice.
Is it perhaps, working (by which I mean my built App displays as it should) on my PC because of the following? I got this from http://codelite.org/LiteEditor/WxWidgets30Binaries
I doubt it: wx-config --libs => -L/usr/local/lib -pthread /usr/local/lib/libwx_gtk3u_xrc-3.0.a ...
shows it's finding your self-built static build in /usr/local/lib. The WxWidgets30Binaries ones are shared, not static, and install to /usr/lib.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

DavidHart wrote:
Then I ran it again selecting the last option.
4 /usr/lib/arm-linux-gnueabihf/wx/config/gtk2-unicode-release-2.8 288 manual mode
That selected a wx2.8 build. I suggest you do it again and select 0 (or 3, it's the same one) to get the wx3.0 build.

However I'm surprised about:
main.cpp:12:19: fatal error: wx/wx.h: No such file or directory
The 2.8 build does have one :/
Hmm, didn't understand what 'gtk2-unicode-release-2.8' meant, I picked it because of the 'gtk2' bit at the front.
Building my new PC at the moment, so I'll look at the Pi when the new machine is all sorted.
Thanks.
Phil.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

Ok, so instead of building wxwidgets myself, I installed it on my new machine following the instructions here http://codelite.org/LiteEditor/WxWidgets30Bin
My machine is Mint-Cinnamon 64.
I did

Code: Select all

sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ artful universe
then (as instructed)

Code: Select all

apt-get update
then I ran a script which did this lot (not verbatim, each line had apt-get blah-di-blah)

Code: Select all

apt-get install libwxbase3.0-0-unofficial \
                 libwxbase3.0-dev \
                 libwxgtk3.0-0-unofficial \
                 libwxgtk3.0-dev \
                 wx3.0-headers \
                 wx-common \
                 libwxbase3.0-dbg \
                 libwxgtk3.0-dbg \
                 wx3.0-i18n \
                 wx3.0-examples \
                 wx3.0-doc
This then results in:

Code: Select all

phil@phil-OptiPlex-380 ~/ $ wx-config --version
3.0.4
phil@phil-OptiPlex-380 ~/$ wx-config --libs
-L/usr/lib/x86_64-linux-gnu -pthread   -lwx_gtk2u_unofficial_xrc-3.0 -lwx_gtk2u_unofficial_webview-3.0 -lwx_gtk2u_unofficial_html-3.0 -lwx_gtk2u_unofficial_qa-3.0 -lwx_gtk2u_unofficial_adv-3.0 -lwx_gtk2u_unofficial_core-3.0 -lwx_baseu_unofficial_xml-3.0 -lwx_baseu_unofficial_net-3.0 -lwx_baseu_unofficial-3.0 
phil@phil-OptiPlex-380 ~/ $ wx-config --cxxflags
-I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0-unofficial -I/usr/include/wx-3.0-unofficial -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
ph
Then running my compile and link script (which used to work) results in the following. I have not changed my source code or the script.

Code: Select all

In file included from /usr/include/c++/5/type_traits:35:0,
                 from /usr/include/wx-3.0-unofficial/wx/strvararg.h:25,
                 from /usr/include/wx-3.0-unofficial/wx/string.h:46,
                 from /usr/include/wx-3.0-unofficial/wx/memory.h:15,
                 from /usr/include/wx-3.0-unofficial/wx/object.h:19,
                 from /usr/include/wx-3.0-unofficial/wx/wx.h:15,
                 from main.cpp:12:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^
In file included from /usr/include/wx-3.0-unofficial/wx/string.h:46:0,
                 from /usr/include/wx-3.0-unofficial/wx/memory.h:15,
                 from /usr/include/wx-3.0-unofficial/wx/object.h:19,
                 from /usr/include/wx-3.0-unofficial/wx/wx.h:15,
                 from main.cpp:12:
/usr/include/wx-3.0-unofficial/wx/strvararg.h:350:18: error: ‘is_enum’ in namespace ‘std’ does not name a template type
     typedef std::is_enum<T> is_enum;
                  ^
/usr/include/wx-3.0-unofficial/wx/strvararg.h:354:54: error: ‘is_enum’ was not declared in this scope
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                      ^
/usr/include/wx-3.0-unofficial/wx/strvararg.h:354:68: error: template argument 1 is invalid
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                                    ^
^Z
[3]+  Stopped  
I tried both of the compiler options mentioned in the error message, both resulted in an apparently successful compile and link but both also resulted in this:

Code: Select all

phil@phil-OptiPlex-380 ~ $ ./MyApp
Fatal Error: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1009,wx containers,compatible with 2.8).
Aborted (core dumped)
phil@phil-OptiPlex-380 ~ $ 
So what am I supposed to do? What have I done wrong now?
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

I built those wx libs, on a standard i386 virtualbox guest. I don't have an RPi or similar, and I'm blissfully ignorant about what will/won't work in an arm device when built on i386. However I suspect it's not supposed to work. If so, that explains the problem; the solution is to uninstall those libs, remove the CodeLite repo from your /etc/apt/sources.list (or wherever) and install the debian wx3.0.2 packages as those are designed for arm.

However if I'm wrong, then:
Then running my compile and link script (which used to work) results in the following. I have not changed my source code or the script.
^Z
[3]+ Stopped
That's a bit ambiguous. Did the build succeed?

Assuming it did I suspect that, on running the program, the linker is finding e.g. your /usr/local/ install and linking to those libs.
What is the result of doing, in a terminal:
ldd /full/path/to/MyApp
Look for the wx libs it's outputting. In fact you could filter out the non-wx stuff by instead doing:
ldd /full/path/to/MyApp | grep wx

Does that show libs from /usr/local/* ?

If so, try doing: LD_LIBRARY_PATH=/usr/lib/${FOO} ./MyApp
where ${FOO} is your arm equivalent of my /usr/lib/x86_64-linux-gnu/
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

"My machine is Mint-Cinnamon 64."
Not the pi.
This is my new PC, no previous install of anything wxWidgets related.
Previously, I had wxWidgets working having downloaded the source and built it.
Now, we are talking about a new machine with a new intall of wxWidgets as specifed specified earlier.
Right now the RPi is not involved in any way.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

"My machine is Mint-Cinnamon 64."
Sorry, I missed that line.
Fatal Error: Mismatch between the program and library build versions detected.
That error message should only happen when there are 2 wxWidgets builds installed, one of which is used for building the program, the other at runtime. I was struggling to explain what could cause it in this situation. So I replicated your setup in my Mint vbox guest.

While doing that I noticed that you installed the 'artful' packages. Mint uses 'xenial'. I first installed the artful ones and got the same error. After removing those, cleaning the cache, and replacing them with the xenial ones, the 'minimal' sample now builds and runs OK.

I'm still struggling to understand why we get that mismatch error, but anyway: you need to do:
sudo apt remove <all those wx packages>
sudo apt clean
(The -r in the next line should remove the artful entry)
sudo apt-add-repository -r 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ artful universe'
sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ xenial universe'
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

DavidHart wrote:
"My machine is Mint-Cinnamon 64."
...... you need to do:
sudo apt remove <all those wx packages>
sudo apt clean
(The -r in the next line should remove the artful entry)
sudo apt-add-repository -r 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ artful universe'
sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ xenial universe'
Ah, fab, thanks I'll do that! :D
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

]
DavidHart wrote: ...... you need to do:
sudo apt remove <all those wx packages>
sudo apt clean
(The -r in the next line should remove the artful entry)
sudo apt-add-repository -r 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ artful universe'
sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0.4/ubuntu/ xenial universe'
Ok, I've done that, should I run this again?
apt-get install libwxbase3.0-0-unofficial \
libwxbase3.0-dev \
libwxgtk3.0-0-unofficial \
libwxgtk3.0-dev \
wx3.0-headers \
wx-common \
libwxbase3.0-dbg \
libwxgtk3.0-dbg \
wx3.0-i18n \
wx3.0-examples \
wx3.0-doc
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

Yes.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

DavidHart wrote:Yes.
Thanks!
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

Fab, thank you David. My new PC is configured cleanly for wxWidgets whick is working nicely.
I'm assuming from comments you made earlier that I cannot use one of these distros and will have to build wxWidgets on the RPi? Is that correct?
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

I'm assuming from comments you made earlier that I cannot use one of these distros and will have to build wxWidgets on the RPi? Is that correct?
Not the CodeLite ones, no. But Mint xenial has official wx3.0.2 packages. See https://packages.ubuntu.com/search?suit ... gtk3.0-dev. These are built for armhf too so, IIUC fromhttps://wiki.debian.org/RaspberryPi, apt install libwxgtk3.0-dev should work.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

On the pi, after entirely annihilating all trace of my botched build of wxWidgets I did this:

Code: Select all

sudo apt-get update
apt-cache search wxwid

copied this "libwxgtk3.0-dev" from the long list of results
then

Code: Select all

sudo apt-get install libwxgtk3.0-dev
after this completed

Code: Select all

pi@raspberrypi:~ $ wx-config --version
3.0.2
pi@raspberrypi:~ $ wx-config --libs
-L/usr/lib/arm-linux-gnueabihf -pthread   -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 
pi@raspberrypi:~ $ wx-config --cxxflags
-I/usr/lib/arm-linux-gnueabihf/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
pi@raspberrypi:~ $ 
sudo update-alternatives --config wx-config
There are 2 choices for the alternative wx-config (providing /usr/bin/wx-config).

  Selection    Path                                                     Priority   Status
------------------------------------------------------------
* 0            /usr/lib/arm-linux-gnueabihf/wx/config/gtk2-unicode-3.0   308       auto mode
  1            /usr/lib/arm-linux-gnueabihf/wx/config/base-unicode-3.0   307       manual mode
  2            /usr/lib/arm-linux-gnueabihf/wx/config/gtk2-unicode-3.0   308       manual mode

Press <enter> to keep the current choice[*], or type selection number: 

I left "alternative wx-config" as it was
Then I built my fledgling program with my heart in my mouth.
Voila!
ItLives.jpg
ItLives.jpg (41.05 KiB) Viewed 2728 times
this is one of the other frames at the default font
defaultfont.jpg
defaultfont.jpg (12.98 KiB) Viewed 2728 times
So, there you go I either effed somthing when I originally built wxWidgets or indirectly effed it by building with GTk3 - as you suggested.

Thanks one and all, I'm in business. Now all I have to do is find out how to connect my c++ app to ALSA, that's going to be an arduous search no doubt!

A note on wxFormBuilder: Only the windows version of it seems to work properly. Since I am trying to move all my development work to Linux (my Linux machine is way, way faster than my windows one for a start) it looks like I need to find an alternative GUI-GUI designer.

Again, I can't thank you folks enough for the help, especially David.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

OT: If you don't mind nagware, I suggest wxCrafter. It's a CodeLite plugin but can (still afaik) be used as a standalone. But then I recommend CodeLite as a (FOSS) IDE anyway; I use it (and help out on it).
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

I dare say you've seen my other post relating to difficulties installing that.
BTW, I've just checked the RPi in my MIDI controller (not the RPi I use to build my apps).
That is GTK2. So that seems to show that building with GTK3 is where the issue lies. Just a thought.
Post Reply