繁体   English   中英

如何为Android构建Qt5?

[英]How to build Qt5 for Android?

我有一台运行Ubuntu 12.04 LTS的服务器。

我想把服务器用于构建Android ARMv6平台的Qt5。 如何在无头服务器上进行此操作?

在Ubuntu 12.04 LTS上为Android编译Qt5所需的步骤如下所述。 为方便起见,我假设下面的所有命令都在目录/opt/qt5-android 如果不是这种情况,您将需要相应地调整路径。

  1. 首先,您需要确保安装了相应的软件包:

     sudo apt-get install build-essential openjdk-6-jdk 
  2. 抓住最新的Android SDK:

     wget http://dl.google.com/android/android-sdk_r21.1-linux.tgz tar -xf android-sdk_r21.1-linux.tgz 
  3. SDK不附带任何平台,因此您需要抓取它们:

     android-sdk-linux/tools/android update sdk --no-ui 
  4. 获取最新版本的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 
  5. 现在克隆以下Git存储库:

     git clone git://gitorious.org/qt/qt5.git qt5 cd qt5 perl init-repository --no-webkit 
  6. 我们快到了。 现在我们需要configuremake 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版本。


参考文献:

我不是故意回答另一个答案,但这是我的第一篇文章:-(我认为这使我无法在评论中发布此内容。(因此,请考虑这是对所述答案的引用,而不是对内森自己的回答并不适合我。

我的配置行看起来更像是这样:

./configure \
-developer-build -platform linux-g++-64 \
-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 \
-android-ndk-host linux-x86_64

原因如下:

  • -skip qtwebkit-examples-and-demos在配置中导致错误...它不喜欢我正在跳过无法构建的东西(抱歉,我丢失了确切的错误消息)

  • -android-ndk-host linux-x86_64停止配置中止“ Can not detect the android host. Please use -android-ndk-host option to specify one

  • -platform linux-g++-64我是偏执的关于configure是否会为我添加-m64标志或其他什么

除了这种差异,内森的手术似乎有点像魅力。 我现在的当地环境建设(感谢提示,奥斯曼先生:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM