Host> sudo apt update
Host> sudo apt install lib32stdc++6 lib32z1 lzop
Host> sudo apt install build-essential gcc
Host> sudo apt install python
Host> mkdir qt5
Host> mkdir qt5/qt-build #qt라이브러리의 컴파일을 수행할 디렉토리
Host> mkdir qt5/sysroot #타겟보드의 root파일 시스템을 가져올 디렉토리, 뒤에서 자세히 설명
Host> cd qt5 #앞으로 모든 작업은 이 디렉토리에서 수행
Host> wget https://releases.linaro.org/components/toolchain/binaries/4.9-2017.01/arm-linux-gnueabihf/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz #크로스 툴체인 다운로드
Host> wget http://qtmirror.ics.com/pub/qtproject/archive/qt/5.6/5.6.3/single/qt-everywhere-opensource-src-5.6.3.tar.xz #qt5 소스코드 다운로드
Host> tar -xvf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
Host> tar -xvf qt-everywhere-opensource-src-5.6.3.tar.xz #압축풀기
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
QMAKE_CXX = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy
QMAKE_NM = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -P
QMAKE_STRIP = /Your/Directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip
load(qt_config)
Host> cd qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/devices
Host> cp qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/devices/linux-rasp-pi2-g++ linux-myrasp-pi-g++
# qmake configuration for the Raspberry Pi 3B
include(../common/linux_device_pre.conf)
QMAKE_CFLAGS += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
DISTRO_OPTS += hard-float
DISTRO_OPTS += deb-multi-arch
# Preferred eglfs backend
EGLFS_DEVICE_INTEGRATION = eglfs_brcm
include(../common/linux_arm_device_post.conf)
load(qt_config)
Host> cd sysroot
Host> mkdir lib
Host> mkdir usr
Host> mkdir usr/local
Host> rsync -r --copy-links pi@yourpiaddress:/lib/ lib/
Host> rsync -r --copy-links pi@yourpiaddress:/usr/include/ usr/include/
Host> rsync -r --copy-links pi@yourpiaddress:/usr/lib/ usr/lib/
Host> rsync -r --copy-links pi@yourpiaddress:/usr/local/include/ usr/local/include/
Host> rsync -r --copy-links pi@yourpiaddress:/usr/local/lib/ usr/local/lib/
Host> cd qt-build
Host> ../qt-everywhere-opensource-src-5.6.3/configure -xplatform linux-arm-gnueabi-g++ -release -opengl es2 -device linux-myrasp-pi-g++ -sysroot /your/directory/qt5/sysroot -prefix /usr/local/qt5 -device-option CROSS_COMPILE=/your/directory/qt5/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -qt-xcb
Host>....
The OpenGL ES 2.0 functionality test failed!
Use of pkg-config is not enabled, maybe you want to pass -pkg-config?
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
/root/qt5/qt-src/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/devices/linux-myrasp-pi-g++.
Target> sudo apt install libglfw3-dev libgles2-mesa-dev
Build options:
Configuration .......... accessibility accessibility-atspi-bridge audio-backend c++11 c++14 clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus egl eglfs enable_new_dtags evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap neon no-pkg-config opengl opengles2 pcre png posix_fallocate precompile_header qpa qpa reduce_exports release rpath shared small-config system-png system-zlib threadsafe-cloexec xcb xcb-plugin xcb-qt xkbcommon-qt xlib xrender
Build parts ............ libs examples
Mode ................... release
Using sanitizer(s)...... none
Using C++ standard ..... c++14
Using gold linker....... no
Using new DTAGS ........ yes
Using PCH .............. yes
Using LTCG ............. no
Target compiler supports:
Neon ................. yes
Qt modules and options:
Qt D-Bus ............... yes (loading dbus-1 at runtime)
Qt Concurrent .......... yes
Qt GUI ................. yes
Qt Widgets ............. yes
Large File ............. yes
QML debugging .......... yes
Use system proxies ..... no
Support enabled for:
Accessibility .......... yes
ALSA ................... no
CUPS ................... no
Evdev .................. yes
FontConfig ............. no
FreeType ............... yes (bundled copy)
Glib ................... no
GStreamer .............. no
GTK theme .............. no
HarfBuzz ............... yes (bundled copy)
Iconv .................. yes
ICU .................... no
Image formats:
GIF .................. yes (plugin, using bundled copy)
JPEG ................. yes (plugin, using bundled copy)
PNG .................. yes (in QtGui, using system library)
libinput................ no
Logging backends:
journald ............... no
syslog ............... no
mtdev .................. no
Networking:
getaddrinfo .......... yes
getifaddrs ........... yes
IPv6 ifname .......... yes
libproxy.............. no
OpenSSL .............. no
OpenGL / OpenVG:
EGL .................. yes
OpenGL ............... yes (OpenGL ES 2.0+)
OpenVG ............... no
PCRE ................... yes (bundled copy)
pkg-config ............. no
PulseAudio ............. no
QPA backends:
DirectFB ............. no
EGLFS ................ yes
EGLFS i.MX6 ........ no
EGLFS i.MX6 Wayland. no
EGLFS EGLDevice .... no
EGLFS GBM .......... no
EGLFS Mali ......... no
EGLFS Raspberry Pi . no
EGLFS X11 .......... no
LinuxFB .............. yes
Mir client............ no
XCB .................. yes (bundled copy)
EGL on X ........... no
GLX ................ no
MIT-SHM ............ yes
Xcb-Xlib ........... no
Xcursor ............ yes (loaded at runtime)
Xfixes ............. yes (loaded at runtime)
Xi ................. yes (loaded at runtime)
Xi2 ................ no
Xinerama ........... yes (loaded at runtime)
Xrandr ............. yes (loaded at runtime)
Xrender ............ yes
XKB ................ yes
XShape ............. yes
XSync .............. yes
XVideo ............. yes
Session management ..... yes
SQL drivers:
DB2 .................. no
InterBase ............ no
MySQL ................ no
OCI .................. no
ODBC ................. no
PostgreSQL ........... no
SQLite 2 ............. no
SQLite ............... yes (plugin, using bundled copy)
TDS .................. no
tslib .................. no
udev ................... no
xkbcommon-x11........... yes (bundled copy, XKB config root: /usr/share/X11/xkb)
xkbcommon-evdev......... no
zlib ................... yes (system library)
NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
Configure with '-qreal float' to create a build that is binary compatible with 5.1.
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/qt5
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
Host> make
Host> make install
Target> cd /usr/local
Target> sudo mkdir qt5
Target> sudo chown pi qt5
Host> rsync -r --copy-links /Your/Directory/qt5/usr/local/qt5 pi@1yourpiaddress:/usr/local/
Host> apt install qtcreator
Host> qtcreator
사실 지금은 qt를 업무적으로 하고 있진 않지만 전 회사에서 qt 크로스 컴파일 환경을 만들다 엄청 고생했던 기억이 있어서 남겨두지 않으면 아깝다라는 생각이 들어 이렇게 남겨두게 되었습니다. 그 때는 windows에 개발환경을 세팅하느라 더 고생했던 감도 없지않아 있긴 하지만..