配置Qt Creator使用Clang和Qt for Android

6
看起来 GCC 现在已经被弃用并且将从Android NDK中删除;将使用Clang。 话虽如此,Android NDK 永远不会支持 GCC5,也不会更新关于GCC的相关内容。
话虽如此,我想要在Qt for Android中使用Clang,似乎这方面的工作已经针对Qt 5.7.1进行了:https://bugreports.qt.io/browse/QTBUG-50724,但我不知道如何配置Qt Creator以便在Android配置下使用Clang,而Qt Creator不能自动检测到配置。

enter image description here

有没有人知道如何配置Qt Creator,以及在哪里可以找到AndroidClang编译器?它们似乎在/Users/user/Library/Android/sdk/ndk-bundle/中的某个地方,但我就是无法弄对。我使用的是Qt Creator 4.2.2

是否可以使用Clang来使用Qt for Android


嗨,Jacob,你解决了这个问题吗? - Andrew Vovk
1
很遗憾,目前还没有解决方案。我们在不久的将来需要找到一个解决方案,因为我们正在使用Qt为Android开发产品,并且越来越需要它...很遗憾Google取消了对GCC的支持... - Jacob Krieg
1个回答

3

我已尝试手动添加C和C++的Clang编译器,并取得了一定的成功。

编译器路径:/home/david/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++

平台代码生成标志:-target armv7-none-linux-androideabi

您需要按照相同的方式构建Qt!我的配置命令如下:

export OPENSSL_LIBS='-L/home/david/QtAndroidBuild/OpenSSL/libs/armeabi-v7a/lib -lssl -lcrypto'
./configure -xplatform android-clang \
    --disable-rpath \
    -nomake tests \
    -nomake examples \
    -android-ndk /home/david/Android/Sdk/ndk-bundle \
    -android-sdk /home/david/Android/Sdk \
    -android-ndk-host linux-x86_64 \
    -android-toolchain-version 4.9 \
    -android-arch armeabi-v7a \
    -android-ndk-platform android-19 \
    -skip qttranslations \
    -skip qtserialport \
    -skip qt3d  \
    -skip qtcharts \
    -skip qtdoc \
    -skip qtmultimedia \
    -openssl-linked \
    -no-warnings-are-errors \
    -opensource \
    -confirm-license  \
    -I /home/david/QtAndroidBuild/OpenSSL/libs/armeabi-v7a/include \
    -prefix /home/david/apps/QtAndroidClang \
    -recheck

您可能不需要/不想要OpenSSL,因此可以根据需要进行调整。我构建了5.10.1版本。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接