How to Build wxWidgets / C++ for Raspberry Pi Model 2 (ARMv7 Architecture).
UPDATED:
For ease to install and configure Eclipse-IDE/Toolchain, use following link of ready used installer:
wxWidgets is an awesome C++/GUI library to work with. It can produce very nice desktop interface and has complete class library either for GUI on non GUI. Binary program yields by this library is also small and portable. Statically linking is possible to make the program running independently to any linux distribution.
Raspberry Pi is credit card sized computer, it has small form factor with capability similar to PC of PIII/900MHz with 1GB RAM. Thus, sufficient to running desktop application, as in his case, Raspbian Wheezy.
Here, you will find brief tutorial how to build wxWidgets for Raspbian to run on Raspberry Pi model 2 (ARMv7 processor).
Setup environment to used are:
- Build system on Ubuntu 14.04 LTS x64
- buildroot
- wxWidgets-3.0.2
- Target: RaspberryPi2 and Raspbian Wheezy
Build Toolchain for ARMv7
To build cross architecture Toolchain we can use awesome build system called buildroot (http://buildroot.uclibc.org/)
$ cd ~
$ mkdir wxWidgets
$ cd ~/wxWidgets
$ git clone git://git.buildroot.net/buildroot
$ cd buildroot
$ make raspberrypi2_defconfig
$ make menuconfig
Adjust some requirement as follow:
Toolchain
C library (uClibc) --->
(X) glibc
Target packages > Graphic libraries and applications
[*] X.org X WIndow System --->
Target packages > Libraries > Graphics
[X] libgtk2
[Save]
$ make
Build wxWidgets for ARMv7
Once above toolchain baked and cooked well, then we can start to build and compile wxWidgets and it’s sample application.
$ export PATH=~/wxWidgets/buildroot/output/host/usr/bin:$PATH
$ cd ~/wxWidgets
$ wget http://nchc.dl.sourceforge.net/project/wxwindows/3.0.2/wxWidgets-3.0.2.tar.bz2
$ tar -xzpvf wxWidgets-3.0.2.tar.bz2
$ cd wxWidgets-3.0.2
$ mkdir -p build_rpi2/wx3.0.2u_static
$ cd build_rpi2/wx3.0.2u_static
$ ../../configure --host=arm-linux --with-gtk --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-regex=builtin --with-zlib=builtin --with-expat=builtin LDFLAGS="-static-libgcc -static-libstdc++"
$ make
Sit back and relax......
Build Sample Application
$ cd samples/minimal
$ make
Copy sample/minimal/minimal to Pi's sdcard and from there try to run:
$ ./minimal
See the result ................
After adjusting some path as describe on buildroot manual, you can download ready used
Raspberrypi-Toolchain on sourceforge.net. The toolchain already tested on Ubuntu 14.04 with wxWidgets-3.0.2 as target built. This toolchain can be used for compiling Plain C/C++ for Pi application.