Compiling Qt5.5 for LeMaker Guitar

From BananaPro/Pi
Jump to: navigation, search

Other languages:
English • ‎中文(简体)‎

Environment

PC: Ubuntu16.04(64bit)
Cross compiler: Linaro Linux host toolchains(gcc-linaro-arm-linux-gnueabihf-4.9-2014.07_linux.tar.xz)
Qt source code: qt-everywhere-opensource-src-5.5.1.tar.gz (visit http://www.qt.io/download-open-source/#section-2 and you can use a newer version)

Compile

Prepare

Unzip the Qt source file and then edit this file to point the cross comiler:

vim qt-everywhere-opensource-src-5.5.1/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

Finally, the file looks like this:

#
# qmake configuration for building with arm-linux-gnueabi-g++
#
 
MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib
 
QT_QPA_DEFAULT_PLATFORM = linux #eglfs  
QMAKE_CFLAGS_RELEASE   += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
 
 
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
 
# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabihf-gcc
QMAKE_CXX               = arm-linux-gnueabihf-g++
QMAKE_LINK              = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++
 
# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabihf-objcopy
QMAKE_NM                = arm-linux-gnueabihf-nm -P
QMAKE_STRIP             = arm-linux-gnueabihf-strip
load(qt_config)

Configure and make

./configure -release -opensource -xplatform linux-arm-gnueabi-g++ -prefix /opt/qt5-arm -no-c++11 -no-opengl

Know more via ./configure -help
NOTE: -prefix /opt/qt5-arm means that the library files will be installed to this directory, of couse you can point it to other directory.
You will be allowed to make two chooses:

   Type 'o' if you want to use the Open Source Edition.
Type 'yes' to accept this license offer.

Type 'o' and 'yes'.
After that, run make and then make install.
You will find this files in /opt/qt5-arm which means you did it successfully.
Qt-libfiles.png
Next, copy the lib and plugins to guitar.

Configure on Guitar

After copy lib and plugins to guitar(/opt/qt5-arm for example), add next context to /etc/profile:

export QTDIR=/opt/qt5-arm 
export QT_QPA_FONTDIR=$QTDIR/lib/fonts 
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/ 
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH 
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0

Then, run source /etc/profile.

Configure on PC

You should installed Qt for linux first(http://www.qt.io/download-open-source/#section-2) and this will install a qt-creator automaticly.
Open you qt-creator, setting:
Qt-settings.png
Then add versions, compilers and debuggers manually for Guitar:
Qt-addversion.png
Qt-addcompiler.png
Qt-adddebugger.png
And then add kits manually and choose the compiler, debugger and version for it:
Qt-addkit.png
Now, you can choose different kit to debug your project:
Qt-showkit.png