NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Cross compiling qt libraries for 903x

Hi, I'm trying to cross-compile qt libraries version 4.8.6:

http://www.qt.io/download-open-source/

in particular this tarball:

http://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz

I'm running a lubunti VM wit the ni linux rt toolchain installed from this link: https://decibel.ni.com/content/docs/DOC-39252

Once extracted I run the following command:

configure -opengl es2 --prefix=/opt/Qt-4.8.6/ -device-option CROSS_COMPILE=/usr/local/oecore-x86_64/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-tuaMadre -sysroot /usr/local/oecore-x86_64/sysroots/x86_64-nilrt-linux

Unfortunately during the process I get the following error:

....

g++ -c -o qxmlutils.o -pipe -DQMAKE_OPENSOURCE_EDITION -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -Igenerators/integrity -I/home/tux/qt-build/include -I/home/tux/qt-build/include/QtCore -I/home/tux/qt-build/src/corelib/global -I/home/tux/qt-build/src/corelib/xml -I/home/tux/qt_source/qt-everywhere-opensource-src-4.8.6/tools/shared -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/home/tux/qt_source/qt-everywhere-opensource-src-4.8.6/mkspecs/linux-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DEPRECATED  /home/tux/qt_source/qt-everywhere-opensource-src-4.8.6/src/corelib/xml/qxmlutils.cpp

g++ -o "/home/tux/qt-build/bin/qmake" project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o qfilesystementry.o qfilesystemengine_unix.o qfilesystemengine.o qfilesystemiterator_unix.o qfsfileengine_unix.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlocale_unix.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o 

Basic XLib functionality test failed!

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

QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/tux/qt_source/qt-everywhere-opensource-src-4.8.6/mkspecs/linux-g++.

What am I missing?

By the way, I firs tried to compile the lates 5.7 version of the qt libraries but I get an error saying that C++11 is not available. I'm afraid we don't shit that compiler with our toolchain, is it right? Are we planning to include it in next releases?

thanks

Fabio

Fabio M.
NI
Principal Engineer
0 Kudos
Message 1 of 7
(5,621 Views)

What software stack are you using?

The 2015 stack already has Qt 4.8.6 in the feeds (e.g. http://download.ni.com/ni-linux-rt/feeds/2015/x64/ipk/core2-64/). You should be able to skip the compile and just install what you need from feeds using the 'opkg' utility.

0 Kudos
Message 2 of 7
(5,158 Views)

Chuck_81 wrote:

...

By the way, I firs tried to compile the lates 5.7 version of the qt libraries but I get an error saying that C++11 is not available. I'm afraid we don't shit that compiler with our toolchain, is it right? Are we planning to include it in next releases?

thanks

Fabio

Can you turn on verbosity in the configuration operation? There is a subset of C++11 functionality in the g++ 4.7 toolchain that is downloadable, it may be either the case that the test is checking for something that is not available (see: https://gcc.gnu.org/projects/cxx-status.html#cxx11) or that the arguments are not properly being passed to the toolchain. In either case, turning up the verbosity should help determine what's going on.

0 Kudos
Message 3 of 7
(5,158 Views)

Hi,

I've found ouy which version I've to use. it's 5.1.1.

I got the source from here:

http://download.qt.io/archive/qt/5.1/5.1.1/single/

and run the same ./configure script as before with the options below:

./configure -opengl es2 --prefix=/opt/Qt-5.1/ -device-option CROSS_COMPILE=/usr/local/oecore-x86_64/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux/ -sysroot /usr/local/oecore-x86_64/sysroots/x86_64-nilrt-linux

and I get this error:

g++ -o "/home/tux/qt-build/qtbase/bin/qmake" project.o option.o property.o main.o ioutils.o proitems.o qmakeglobals.o qmakeparser.o qmakeevaluator.o qmakebuiltins.o makefile.o unixmake2.o unixmake.o mingw_make.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o gbuild.o cesdkhandler.o qtextcodec.o qutfcodec.o qstring.o qstringbuilder.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o qlogging.o qfilesystemengine_unix.o qfilesystemiterator_unix.o qfsfileengine_unix.o qlocale_unix.o

Running configuration tests...

The OpenGL ES 2.0 functionality test failed!

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

QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in

/home/tux/qt_source/qt-everywhere-opensource-src-5.1.1/qtbase/mkspecs/linux-g++.

Can it be a wrong setup in configure options? How can I check if I'm pointing to the right location for the cross toolchain?

Thanks

Fabio M.
NI
Principal Engineer
0 Kudos
Message 4 of 7
(5,158 Views)

You should let the 'configure' script figure out the OpenGL implementation instead of specifying 'es2'. 903x should work with the full OpenGL implementation.

Another thing you might not know about: in Linux the library that implements OpenGL is called 'mesa' so you are going to have to install the mesa libraries both on the target and on the build machine you are using to cross-compile. Depending on the Linux distro you are using on the build machine the development files might be in a separate package - for example if you see mesa and mesa-dev in your package manager, install both.

0 Kudos
Message 5 of 7
(5,158 Views)

Thanks Gratian, I'm using ubunt 14.04.4 and I've checked that mesa package is installed by running the command sudo apt-get install mesa-common-dev. It says I already have the latest package.

By the way, I've been able to overcome the issue with the ./configure script by defining a new device and its associated qmake as described here:

http://doc.qt.io/qt-5/embedded-linux.html

So then I run the command below:

configure --prefix=/opt/Qt-5.1/ -device linux-x86_64-nilrt-g++ -device-option CROSS_COMPILE=/usr/local/oecore-x86_64/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux- -sysroot /usr/local/oecore-x86_64/sysroots/x86_64-nilrt-linux/ -nomake tests -v -confirm-license

Now I'm able to compile and to create the components for the 903x. The last thing I've to do is to include the right plugins, since when I run an example I get this error:

bash-4.2# ./blurpicker

This application failed to start because it could not find or load the Qt platform plugin "eglfs".

Available platform plugins are: linuxfb, minimal, offscreen.

Reinstalling the application may fix this problem.

Aborted

Do you know which plugins you added to the qt-everywhere source to obtain a sort of minimal qt installation?

Thanks

Fabio M.
NI
Principal Engineer
0 Kudos
Message 6 of 7
(5,158 Views)

First, from the Qt documentation, as soon as you direct Qt's configure to use a  sysroot, it will ignore the libraries installed on your actual build environment, so it doesn't matter if you install mesa-dev if you're going to pass sysroot. I think what gratian.crisan was getting at is that, for platforms that are fairly close as is the case for NI Linux RT x64 and a normal desktop distribution, attempting to cross compile (especially something as large and multi-faceted as Qt) could be the source of more problems than it solves (those issues being the differences between the distributions actually breaking the built result). That said...

Something in your configuration (likely calling to cross-compile and defining a device has something to do with this) directs the qt config system to assume that you're not going to be providing a windowing system even though you have a display driver (this is what eglfs is meant to address).

If you want to continue the cross-compile route, I'd take a closer look at that configuration file you wrote.

0 Kudos
Message 7 of 7
(5,158 Views)