如何为Android构建Qt5? [英] How to build Qt5 for Android?
问题描述
我有一台运行Ubuntu 12.04 LTS的服务器.
I have a server running Ubuntu 12.04 LTS.
我想让服务器使用针对Android ARMv6平台构建Qt5.如何在无头服务器上执行此操作?
I would like to put the server to use building Qt5 for the Android ARMv6 platform. How does one go about doing this on a headless server?
推荐答案
下面介绍在Ubuntu 12.04 LTS上为Android编译Qt5所需的步骤.为了方便起见,我假定下面的所有命令都在目录/opt/qt5-android
中运行.如果不是这种情况,则需要相应地调整路径.
The steps necessary for compiling Qt5 for Android on Ubuntu 12.04 LTS are described below. For the sake of convenience, I will assume that all of the commands below are run in the directory /opt/qt5-android
. You will need to adjust the paths accordingly if this is not the case.
-
首先,您需要确保安装了适当的软件包:
First you will need to make sure the appropriate packages are installed:
sudo apt-get install build-essential openjdk-6-jdk
获取最新的Android SDK:
Grab the latest Android SDK:
wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz
tar -xf android-sdk_r21.1-linux.tgz
SDK不随任何平台一起提供,因此您需要使用它们:
The SDK doesn't ship with any platforms, so you will need to grab them:
android-sdk-linux/tools/android update sdk --no-ui
获取NDK的最新版本:
Grab the latest version of the NDK:
32位(i686):
wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2
tar -xf android-ndk-r8e-linux-x86.tar.bz2
64位(amd64):
wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2
tar -xf android-ndk-r8e-linux-x86_64.tar.bz2
现在克隆以下Git存储库:
Now clone the following Git repository:
git clone git://gitorious.org/qt/qt5.git qt5
cd qt5
perl init-repository --no-webkit
我们快到了.现在我们需要 configure
和 make
Qt5:
./configure \
-developer-build \
-xplatform android-g++ \
-nomake tests \
-nomake examples \
-android-ndk /opt/qt5-android/android-ndk-r8e \
-android-sdk /opt/qt5-android/android-sdk-linux \
-skip qttools \
-skip qttranslations \
-skip qtwebkit \
-skip qtserialport \
-skip qtwebkit-examples-and-demos
make
就是这样!现在,您应该以Android的Qt5版本结束.
And that's it! You should now end up with a Qt5 build for Android.
参考:
这篇关于如何为Android构建Qt5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!