Cross-Compiling Qt5 on Beaglebone Black with OpenGL

Hey all,

I’ve been googling around and searching for about 2 days now with no luck.

I’m trying to cross-compile Qt5 (5.3.1 or 5.2.0) for the Beaglebone Black and get Quick 2.0 and Qt Quick Controls working (so I need OpenGL). So far I haven’t been able to find any good sources to walk me through this process.

I’m using a Chipsee [chipsee.com] cape to have an LCD and capacitive touch screen with it. Chipsee gives me several prebuilt images, including a Debian, Angstrom, Android, and LinuxEZSDK images. It looks like the linuxEZSDK and Angstrom images come with all the OpenGL libraries pre-loaded. The LinuxEZSDK comes pre-configured with everything for Qt, but it’s Qt4.8. You can find their repo of images here[chipsee.com].

Right now I’ve been working with the LinuxEZSDK image to try and build Qt5 from source and get it on there. I downloaded the linaro toolchain [launchpad.net] to use for the cross compile. I edited the 5.3.1 source following this tutorial *[armsdr.blogspot.com]*to setup the build for the cross-compile. If I follow that tutorial to a T, it works fine. But if I try and configure using OpenGL by running the following configure script:

  1. …/qt-everywhere-opensource-src-5.3.1/configure -v -opensource -confirm-license-no-pch -no-opengl -opengl es2 -make libs -device linux-beaglebone-g++ -xplatform linux-arm-gnueabihf-g++ -device-option CROSS_COMPILE=/usr/local/linaro/bin/arm-linux-gnueabihf- -sysroot/media/jay/rootfs -no-gcc-sysroot -prefix /opt/qt5

I mounted the SD card that countains the LinuxEZSDK in order to find the OpenGL drivers and set the sysroot to /media/jay/rootfs, which is the root of the OS. Configuring that gives me the following error:

  1. OpenGL ES 2.x auto-detection… ()

  2. /usr/local/linaro/bin/arm-linux-gnueabihf-g++ -c -pipe -O2 -Wall -W -fPIE -I/home/jay/qt-everywhere-opensource-src-5.3.1/qtbase/mkspecs/linux-arm-gnueabihf-g++ -I/home/jay/qt-everywhere-opensource-src-5.3.1/qtbase/config.tests/unix/opengles2 -I. -o opengles2.o /home/jay/qt-everywhere-opensource-src-5.3.1/qtbase/config.tests/unix/opengles2/opengles2.cpp

  3. /home/jay/qt-everywhere-opensource-src-5.3.1/qtbase/config.tests/unix/opengles2/opengles2.cpp:45:25: fatal error:GLES2/gl2.h: No such file or directory

  4. #include <GLES2/gl2.h>

  5. ^

  6. compilation terminated.

  7. make: *** [opengles2.o] Error 1

  8. OpenGL ES 2.x disabled.

  9. The OpenGL ES 2.0 functionality test failed!

  10. You might need to modify the include and library search paths by editing

  11. QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in

  12. /home/jay/qt-everywhere-opensource-src-5.3.1/qtbase/mkspecs/linux-arm-gnueabihf-g++.

I even tried modifying the qmake.conf at /qtbase/mkspecs/linux-arm-gnueabihf-g++ to include the following:

  1. QMAKE_INCDIR_OPENGL += /media/jay/rootfs/usr/include

  2. QMAKE_LIBDIR_OPENGL += /media/jay/rootfs/usr/lib

  3. QMAKE_LIBS_OPENGL_ES2 =

But that resulted in the same error.

Does anyone have any ideas how I can get this cross compiled for the Beaglebone with support for Qt Quick 2 and Qt Quick Controls?

Thanks!

Just use arch linux arm for qt5 as your default.

Hi Jay,

Sorry for deviating from the topic, but I’d like to know if the touchscreen is working fine with your installation of Qt5.

Hi,

I am facing the same problem too. However, missing gl2.h is not the only error I am seeing. There are other similar errors for mysql.h, oci.h etc.
I am using a the kernel version that supports SGX and was able to run a demo program. I do not see gl2.h anywhere in /usr/include directory. Please update if you find out any solution.

Thanks,
Ashwin

Don: I’m unsure of what you mean by using arch-linux arm. Can you explain how I would do this?

Aswin: I’m actually not sure if the touchscreen works with the Qt5 installation yet. The touchscreen is definitely functioning with the image, but I haven’t been able to do any tests yet. If I can get it working with OpenGL, I’ll let you know.

Ashwin: A lot of the errors you get in configuring Qt from source are normal. They just indicate that it tried to build those modules because you didn’t explicitly say to exclude them, but they don’t exist. You can suppress them by passing -no arguments with the module that is giving you the issue when configuring (i.e. -no-sql-mysql). It doesn’t matter much because if everything else is still good, it will still configure successfully and just disable those modules.

Ashwin: Can you elaborate on how you got the SGX stuff working? I’m trying to follow this tutorial and having some difficulties.

Don: I'm unsure of what you mean by using arch-linux arm. Can you explain
how I would do this?

Install arch linux arm on your BBB as opposed to running Debian. Then
install qt5 or qt4 or both

Jay,

I used instructions in http://elinux.org/BeagleBoardDebian#SGX_BeagleBone.2FBeagleBone_Black to build kernel and sgx drivers and installed them to my BBB. The demo example mentioned in link ran fine.

Jay,

Try using just -opengl instead of -opengl es2. I did it and configure output had 'OPENGL Desktop'. I'm guessing full GL was selected instead of ES subset. My /use/include had a GL/ directory but no GLES/ or GLES2/.

Hey guys,

No luck for me in getting this working. Beaglebone seems to have quite a few issues with Qt5 and the build doesn’t seem to want to cooperate. For others looking to pursue the same route, I got several suggestions to take the route of Yocto and bitbaking the meta-ti recipe, which seems promising.

For me, because my project is flexible, (call me a traitor) I switched to a Raspberry Pi to build Qt5 on to. It was incredibly easy to get the latest Qt5.3.1 build on there and all the drivers I needed came pre-installed with the Raspbian image. So if there’s anyone out there like me who isn’t extremely versed in dealing with all the build issues, I’d recommend the Raspberry Pi if you need an embedded platform with Qt5.

Jay

Or you could just use an OS for BBB that has it built for you since you
seem to not be able to build it yourself on that platform.

wipe Debian, install archlinux-arm pacman -S qt5
AndWhatEverElseYouWantQT5Related

Again you can even install qt4 and at5 side by side

profit.

Don,

This may sound strange, but would I be able to install qt5 on arch linux, and then copy all of the qt libraries over to my Angstrom OS and have it work? I am currently not able to switch to an new OS in our product at the current time, so I’m looking for ways to make this work. Thanks,

no. Use the proper build methods for Yocto/Angstrom/OE.

Not possible. The libraries built on x86 or x86_64 are also dynamically linked to x86 or x86_64 libraries.
# file /usr/local/qt5/qtbase/lib/libQt5Core.so.5.3.1
/usr/local/qt5/qtbase/lib/libQt5Core.so.5.3.1: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), BuildID[sha1]=32404e368d550b3270a1aa09380fb52b67f7b91a, not stripped

ARM is a different architecture.
# file /usr/local/qt5/qtbase/lib/libQt5Core.so.5.3.2
/usr/local/qt5/qtbase/lib/libQt5Core.so.5.3.2: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=435ca3248a88788420b0540400cf93054a9aa917, not stripped
Regards
Sid.

uhhh I believe he meant arch linux arm not the x86_64 or i686 Arch Linux… And technically yes he “could” should he no.

Yep, I meant Arch Linux Arm.

For people who come across this post, I recommend to install Debian Wheezy to get QtQuick run on Beaglebone Black, it’s so much easier than Angstrom. This is a youtube video of a guy who did it. Read the comments for more information.

https://www.youtube.com/watch?v=4p9kDyf7Ho4

Unfortunately, on both element14 and armsdr.blogspot.com people have failed to compile with TI’s SGX SDK OpenGL ES support, so it runs using a software rasterizer.