我想在我的LinuxMint 14机器上为运行linux 2.6.32并带有glibc 2.12.1的X86_64机器编译Qt 4.8.5。我使用crosstool-ng创建了一个合适的交叉编译器,并通过这个mkspec(名为linux-cluster)安装了它
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/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = x86_64-unknown-linux-gnu-gcc
QMAKE_CXX = x86_64-unknown-linux-gnu-g++
QMAKE_LINK = x86_64-unknown-linux-gnu-g++
QMAKE_LINK_SHLIB = x86_64-unknown-linux-gnu-g++
# modifications to linux.conf
QMAKE_AR = x86_64-unknown-linux-gnu-ar cqs
QMAKE_OBJCOPY = x86_64-unknown-linux-gnu-objcopy
QMAKE_STRIP = x86_64-unknown-linux-gnu-strip
# Hack to get the config.test to compile at least
QMAKE_INCDIR_X11 = /usr/include/
QMAKE_LIBDIR_X11 = /usr/lib/x86_64-linux-gnu/
load(qt_config)
我的配置调用是:
../qt-everywhere-opensource-src-4.8.5/configure -device-option CROSS_COMPILE=/<home>/x-tools/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu- -platform linux-cluster -xplatform linux-cluster -opensource -verbose -prefix /<home>/qt48-install -continue -no-webkit
Qt似乎使用x86_64-unknown-linux-gnu-g ++编译器配置正常,但是它执行一些config.test,例如它编译了一个失败的测试Xlib应用程序:
x86_64-unknown-linux-gnu-g++ -c -pipe -O2 -Wall -W -I../../../../qt-everywhere-opensource-src-4.8.5/mkspecs/linux-cluster -I../../../../qt-everywhere-opensource-src-4.8.5/config.tests/x11/xlib -I/usr/include -I../../../../qt-everywhere-opensource-src-4.8.5/config.tests/x11/xlib -I. -o xlib.o ../../../../qt-everywhere-opensource-src-4.8.5/config.tests/x11/xlib/xlib.cpp
x86_64-unknown-linux-gnu-g++ -Wl,-O1 -o xlib xlib.o -L/usr/lib/x86_64-linux-gnu/ -lXext -lX11 -lm
/<home>/x-tools/x86_64-unknown-linux-gnu/lib/gcc/x86_64-unknown-linux-gnu/4.3.6/../../../../x86_64-unknown-linux-gnu/bin/ld: warning: libxcb.so.1, needed by /usr/lib/x86_64-linux-gnu//libX11.so, not found (try using -rpath or -rpath-link)
它当然是这样做的,因为交叉编译器中没有libxext。
我的问题是:我在这里进行交叉编译,为什么当qt-build的结果注定要在完全不同的平台上运行时,如果主机(!)能够编译X11应用程序,qt会执行测试?如何禁用(某些)这些配置测试?
(我设法通过在我的配置调用中添加-embedded X86来规避xlib-test,之后qt编译得很好。但是因为我还需要-opengl desktop这不是一个选项,因为它们似乎是互斥的选项)