1. Qt install
Qt 4.7.4 download
ftp://ftp.trolltech.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz
$ tar zxvf qt-everywhere-opensource-src-4.7.4.tar.gz
$ cd qt-everywhere-opensource-src-4.7.4
$ mkdir ./mkspecs/qws/linux-target-g++
$ cd ./mkspecs/qws/linux-
target-g++
$ cp ../linux-arm-g++/qplatformdefs.h ./
$ vi qmake.conf
# qmake configuration for building with
arm-
target-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
#Toolchain
#Compiler Flags to take advantage of the
ARM architecture
QMAKE_CFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp
QMAKE_CXXFLAGS_RELEASE = -O3
-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
QMAKE_CC = arm-none-linux-gnueabi-gcc
QMAKE_CXX = arm-none-linux-gnueabi-g++
QMAKE_LINK = arm-none-linux-gnueabi-g++
QMAKE_LINK_SHLIB =
arm-none-linux-gnueabi-g++
# modifications to linux.conf
QMAKE_AR = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY =
arm-none-linux-gnueabi-objcopy
QMAKE_STRIP =
arm-none-linux-gnueabi-strip
load(qt_config)
|
$ cd ../../.. (source directory)
$ ./configure -prefix <qt-install-dir> -embedded arm -platform qws/linux-x86-g++
-xplatform qws/linux-mdas-g++ -depths 16,24,32 -no-mmx -no-3dnow -no-sse
-no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl
-no-gtkstyle -qt-mouse-pc -qt-mouse-linuxtp -qt-mouse-linuxinput
-plugin-mouse-linuxtp -plugin-mouse-pc -fast -little-endian
$ make
$ make install
## qmake.conf에서 cross compiler지정해주는 부분과 configure option 주는 부분이 중요.
오류 처리
error1:
libQtCore.so:
undefined reference to `QInotifyFileSystemWatcherEngine::create()'
resolution:
edit
./src/corelib/io/io.pri
find linux-*:
append your
cross-toolchain's prefix after it
ex> my
toolchains's prefix is arm-none-linux-gnueabi-XXX
- 77
linux-*|:!symbian {
+ 77
linux-*| arm-none-linux-gnueabi-*:!symbian {
78
SOURCES += \
79
io/qfilesystemwatcher_inotify.cpp \
80
io/qfilesystemwatcher_dnotify.cpp
81
82
HEADERS += \
83
io/qfilesystemwatcher_inotify_p.h \
84
io/qfilesystemwatcher_dnotify_p.h
85
}
86
87
freebsd-*|macx-*|darwin-*|openbsd-*:{
88
SOURCES += io/qfilesystemwatcher_kqueue.cpp
89
HEADERS +=
io/qfilesystemwatcher_kqueue_p.h
90
}
error2:
libQtCore.so:
undefined reference to `clock_gettime'
resolution:
append
"-lrt" parameters after the "./configure" so that the
compiler can find the define in librt.
2. Compile
Qt를 설치할 때 -prefix <qt-install-dir> 옵션을 주었기 때문에
관련 tool들이 <qt-install-dir>에 있다.
cd path/to/myApplication (sources 및 .pro 파일이 있다.)
$ <qt-install-dir>/bin/qmake
–project
$ <qt-install-dir>/bin/qmake
$
make
정상적으로 생성되었는지 확인(결과 파일이 test1이라 할 때)
$
file test1
test1: ELF 32-bit LSB executable, ARM,
version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16,
not stripped
3. Execute
* lib 등록
LD_LIBRARY_PATH 가 맞지 않으면 다음과 같은 오류가 발생한다.
ERROR: Inconsistency detected by ld.so:
dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!
<qt-install-dir>/lib 안에 있는 library를 모두 target board에 복사한다. 이 때 fonts도 함께 복사한다
복사한 library가 target
board에서 /mnt/mmc/lib에 존재한다고 가정함.
target$
export QTDIR=/mnt/mmc
target$
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
* fonts 등록
fonts가 등록되지 않으면 다음과 같은 오류가 발생한다.
QFontDatabase: Cannot find font directory
/opt/Qtarm/lib/fonts - is Qt installed correctly?
target$
mkdir <qt-install-dir>
target$
mkdir <qt-install-dir>/lib
target$
ln -s /mnt/mmc/lib/fonts
<qt-install-dir>/lib/fonts
* 파일 실행
$
./test1 -qws