Windows下源碼編譯Qt-Android

參考文章:Building qt-android on windows

set ANDROID_API_VERSION=android-19
set ANDROID_SDK_ROOT=D:\android\sdk
set ANDROID_TARGET_ARCH=armeabi-v7a
set ANDROID_BUILD_TOOLS_REVISION=23.0.2
set ANDROID_NDK_PATH=D:\android\android-ndk-r10e
set ANDROID_NDK_ROOT=D:\android\android-ndk-r10e
set ANDROID_TOOLCHAIN_VERSION=4.9
set ANDROID_NDK_HOST=windows-x86_64

configure.bat -developer-build -platform win32-g++ -opengl es2 -xplatform android-g++ -android-ndk %ANDROID_NDK_PATH% -android-sdk %ANDROID_SDK_ROOT% -opensource -confirm-license -nomake tests -nomake examples

mingw32-make.exe -j2

編譯報錯:

  409: template <typename T>
  410: Q_INLINE_TEMPLATE void QList<T>::node_destruct(Node *from, Node *to)
  411: {
  412:    if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic)
  413:        while(from != to) --to, delete reinterpret_cast<T*>(to->v);
  414:    else if (QTypeInfo<T>::isComplex)
  415:        while (from != to) --to, reinterpret_cast<T*>(to)->~T();
  416: }

...when compiled for ARM, causes this warning (or error with -Werror):

  src/corelib/tools/qlist.h: In member function ‘void QList<T>::node_destruct(QList<T>::Node*, QList<T>::Node*) [with T = QVariant]’:
  src/corelib/tools/qlist.h:738:5:   instantiated from ‘void QList<T>::dealloc(QListData::Data*) [with T = QVariant]’
  src/corelib/tools/qlist.h:714:9:   instantiated from ‘QList<T>::~QList() [with T = QVariant]’
  src/corelib/statemachine/qstatemachine.h:81:59:   instantiated from here
  src/corelib/tools/qlist.h:415:28: error: cast from ‘QList<QVariant>::Node*’ to ‘QVariant*’ increases required alignment of target type [-Werror=cast-align]

解決方法:
因為在編譯QTDIR\qtscript時報錯,所以將文件夾下Miakefile里的-Wcast-align去掉,再編譯就可以了。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容