如何交叉编译qt4 for arm生成bin/lrelease和lib/libQtDesigner.so

how to cross-compile qt4 for arm to generate bin/lrelease and lib/libQtDesigner.so

我正在我的 x86 ubuntu 14.04 目标上交叉编译 qt4.7.4 到 aarch64 linux 板,我成功了。

但是,有一个问题:我找不到bin/lreleaselib/libQtDesigner.so等等。

我该如何配置才能构建它们?

我的配置是这样的:

export ROOTFS=/aarch64_2
export CROSS_COMPILE=aarch64-unknown-linux-gnueabi
export PKG_CONFIG_PATH=$ROOTFS/usr/local/lib/aarch64-linux-gnu/pkgconfig:$ROOTFS/usr/lib/aarch64-linux-gnu/pkgconfig:$ROOTFS/usr/lib/pkgconfig:$ROOTFS/usr/share/pkgconfig:$ROOTFS/usr/local/lib/pkgconfig:$ROOTFS/usr/local/share/pkgconfig

./configure -release -v  -fast -opensource 
-developer-build -confirm-license 
-nomake examples -nomake demos 
-nomake docs -nomake translations 
-no-openssl  -webkit -no-qt3support 
-no-rpath -phonon -no-opengl 
-dbus -arch aarch64 -xplatform linux-g++-aarch64   -force-pkg-config

和mkspecs/linux-g++-aarch64/qmake.conf是:

MAKEFILE_GENERATOR  = UNIX
TARGET_PLATFORM     = unix
TEMPLATE        = app
CONFIG          += qt warn_on release incremental link_prl         gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib


include(../common/g++.conf)
include(../common/linux.conf)


QMAKE_CC = $$(CROSS_COMPILE)-gcc
QMAKE_CXX = aarch64-unknown-linux-gnueabi-g++
QMAKE_LINK = aarch64-unknown-linux-gnueabi-g++
QMAKE_LINK_SHLIB = aarch64-unknown-linux-gnueabi-g++
QMAKE_AR = $$(CROSS_COMPILE)-ar cr
QMAKE_OBJCOPY = $$(CROSS_COMPILE)-objcopy
QMAKE_STRIP = $$(CROSS_COMPILE)-strip

QMAKE_LFLAGS_RELEASE = -Wl,-O2 
QMAKE_INCDIR += $$(ROOTFS)/usr/include
QMAKE_INCDIR += $$(ROOTFS)/usr/include/aarch64-linux-gnu

QMAKE_LIBDIR += $$(ROOTFS)/usr/lib
QMAKE_LIBDIR += $$(ROOTFS)/usr/lib/aarch64-linux-gnu
QMAKE_LIBDIR += $$(ROOTFS)/lib
QMAKE_LIBDIR += $$(ROOTFS)/lib/aarch64-linux-gnu


QMAKE_INCDIR_X11 = $$(ROOTFS)/usr/include
QMAKE_LIBDIR_X11 = $$(ROOTFS)/usr/lib

QMAKE_INCDIR_OPENGL = $$(ROOTFS)/usr/include
QMAKE_LIBDIR_OPENGL = $$(ROOTFS)/usr/lib

#QMAKE_CFLAGS       = -fpermissive
QMAKE_LFLAGS        = -Wl,-rpath-link $$(ROOTFS)/usr/lib -Wl,-rpath-link     $$(ROOTFS)/usr/lib/aarch64-linux-gnu  -Wl,-rpath-link $$(ROOTFS)/lib -Wl,-rpath-link $$(ROOTFS)/lib/aarch64-linux-gnu

终于知道为什么了。 configure shell 有一个注释:交叉编译时默认不构建工具。所以如果我们是交叉编译,想编译工具,在命令行加上-make tools即可。