Cross compiling WxWidget application for Debian64 and Debian armhf

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.
Post Reply
VdBergh.Paul
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Jul 27, 2018 12:31 pm

Cross compiling WxWidget application for Debian64 and Debian armhf

Post by VdBergh.Paul » Fri Jul 27, 2018 12:42 pm

Hi All,

I'm building a WxWidget application targetting both Debian 64-bits and Debian armhf (Raspberry). I'm using eclipse as IDE running in a Debian 9.4 Virtualbox. The VB Host is Windows10.

The eclipse workspace is organized as tree projects :
  • - one project set up for Debian 64-bits architecture
    - one project set up for Debian armhf architecture (using multiarch)
    - one project with common source files.
In both the 64-bits as the armhf projects, the source code is linked in from the common project.
I installed WxWidgets for 64-bits with the following command:

Code: Select all

sudo apt install libwxgtk3.0-dev
Now, the 64-bits project compiles without errors and the executable works fine under Debian64.
Next, I like to cross-compile for armhf, so

Code: Select all

sudo apt install libwxgtk3.0-dev:armhf
Now, the armhf project compiles without errors and the executable works fine on the Raspberry Pi.
However, the compilation of the 64-bit project is broken...
Apparently, the platform specific setting for WxWidgets are defined/declared in a file called
setup.h
this file is located at

Code: Select all

/usr/lib/PLATFORM/wx/include/gtk2-unicode-3.0/wx/
where PLATFORM is either

Code: Select all

x86_64-linux-gnu
for Debian64 or

Code: Select all

arm-linux-gnueabihf
for Debian armhf.

My observation is that installing one version of the development package installs the correct setup.h, but also removes the other...
So, how do I setup WxWidgets for multi-arch compilation for both platforms?

Thanks in advance,

Paul

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

Re: Cross compiling WxWidget application for Debian64 and Debian armhf

Post by DavidHart » Fri Jul 27, 2018 1:32 pm

Hi,

Debian uses update-alternatives to select between different wx versions. However I don't know if that applies to different arches too; you may find that the two -dev packages 'conflict', so only one can be installed at a time.

To find out, try doing:
sudo update-alternatives --config wx-config

If you see both arches on the list, you can easily switch between them. If not...

Regards,

David

VdBergh.Paul
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Jul 27, 2018 12:31 pm

Re: Cross compiling WxWidget application for Debian64 and Debian armhf

Post by VdBergh.Paul » Fri Jul 27, 2018 2:11 pm

Hi David,

Thanks for your reply. This is the output of the command:

Code: Select all

[email protected]:~$ 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: 
[email protected]:~$ 
So, AFAICS I have to look out for another solution, apparently the package cannot co-exists for both 64-bit and armhf architectures...

Any suggestion to solve this?

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

Re: Cross compiling WxWidget application for Debian64 and Debian armhf

Post by DavidHart » Fri Jul 27, 2018 2:35 pm

apparently the package cannot co-exist for both 64-bit and armhf architectures
I'm not surprised.

Since you're using VirtualBox one solution, if you have the memory, is to clone the guest and install the other arch in the clone. Another, which should use less memory, is to create a snapshot with one package installed and working; then install the other and take another snapshot. You can then easily switch between the two.

A more orthodox alternative would be to build your own wxWidgets from source, configuring it to instal elsewhere e.g. /usr/local/; or (better IMO) build in a subdir of the source, using --prefix=$(pwd). That means that the build can be using in situ, with no need to make install.
Either way, you can then select which wx build is used by eclipse by specifying /full/path/to/wx-config in its Compilation and Linking settings.

Post Reply