Got compile error when build Qt 6.7.2 for Android
-
Hi everyone,
I'm trying build qt for android with the doc android-building. But got a build error may need your help
My environment is Archlinux. I used to success built a qt application for android by qt5 (years ago). And recently I'd like to trying build qt 6.7.2 for android.
I installed android sdk and ndk by sdk manager. According to the doc. I have done the host building and installed host tools by:
cd qt6.7.2-host mkdir build cd build cmake .. -G Ninja -DFEATURE_developer_build=ON -DCMAKE_INSTALL_PREFIX=~/Qt/6.7.2-host cmake --build . --parallel cmake --install .
But got compile error when trying to build qt for andorid with following commands:
cd qt6.7.2-android mkdir build cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DQT_HOST_PATH=~/Qt/6.7.2-host \ -DCMAKE_INSTALL_PREFIX=~/Qt/6.7.2-android \ -DCMAKE_ANDROID_ARCH_ABI=x86_64 \ -DANDROID_SDK_ROOT=~/Android/sdk \ -DANDROID_NDK=~/Android/Sdk/ndk/27.0.12077973 # and got compile error here cmake --build . --parallel
And got compile error message:
Android/Sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__utility/declval.h:31:17: error: static assertion failed due to requirement '!__is_same(float, float)': std::declval can only be used in an unevaluated context. It's likely that your current usage is trying to extract a value from the function. 31 | static_assert(!__is_same(_Tp, _Tp), | ^~~~~~~~~~~~~~~~~~~~ qt6.7.2-android/qtbase/src/corelib/kernel/qjnitypes.h:130:26: note: in instantiation of function template specialization 'std::declval<float>' requested here 130 | return function(std::declval<Args>()...); | ^
So my question is:
- what dose this compile error means?
- is there some configuration or steps I missed?
- how to fix this compile error to build a qt 6.7.2 for andorid?
Thanks!
-
I don't know anything about this, but as the same code has compiled for developers at Qt using an older NDK, I'd suspect its compiler, and would try downgrading the NDK.