- 下载android-lighthouse:http://gitorious.org/~taipan/qt/android-lighthouse
git clone git://gitorious.org/~taipan/qt/android-lighthouse.git 这个就是qt for android 源代码,下面将在此基础上编译基于android的qt库。
- 修改androidconfigbuild.sh
ANDROID_NDK_ROOT 指向android ndk根目录
ANDROID_NDK_HOST设置为当前系统,比如mac os x上应该是darwin-x86
ANDROID_NDK_PLATFORM 设置为已安装的android sdk版本,比如android-15
注意要使用绝对路径,不要使用波浪号tilde当前用户前缀,否则以后gcc -I包括头文件路径时会找不到。下面是mac os x下的片段:
export ANDROID_NDK_ROOT=/lib/android-ndk-r8e
export ANDROID_NDK_HOST=darwin-x86_64
export ANDROID_NDK_TOOLCHAIN_PREFIX=arm-linux-androideabi
export ANDROID_NDK_TOOLCHAIN_VERSION=4.4.3
export ANDROID_NDK_PLATFORM=android-15
- 修改mkspecs/android-g++/qmake.conf
将以上androidconfigbuild.sh中所做的修改也应用在这里,因为qmake生成Makefile时需要这些hardcode路径
执行脚本androidconfigbuild.sh,编译qt for android,然后我注释掉make相关 的。自己make -j4编译。碰到下面问题。
../../include/QtCore/../../src/corelib/tools/qlist.h:412: error: no matching function for call to 'operator new(unsigned int, QList<QFutureCallOutInterface*>::Node*&)'
<built-in>:0: note: candidates are: void* operator new(unsigned int)
../../include/QtCore/../../src/corelib/tools/qlist.h:423: error: 'memcpy' was not declared in this scope
make[1]: *** [.obj/release-shared/qfutureinterface.o] 错误 1
make[1]:正在离开目录 `/home/baimingyong/下载/android-lighthouse/src/corelib'
make: *** [sub-corelib-make_default-ordered] 错误 2
本文档详细介绍了如何从源代码编译适用于Android平台的Qt库。具体步骤包括配置NDK路径、编译环境变量设定及解决编译过程中遇到的问题。

1184

被折叠的 条评论
为什么被折叠?



