From b016f218fbce4c01827a4bf613912b40f646e1df Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 14 Jan 2025 12:47:52 +0100 Subject: [PATCH] ci/android: fix meson C++ cross-compiler argument detection When cross-building for Android meson fails to find supported compiler arguments for the C++ cross-compiler, e.g.: ``` Compiler for C++ supports arguments -Wno-array-bounds: NO (cached) Compiler for C++ supports arguments -Wno-overflow: NO Compiler for C++ supports arguments -Wno-c++11-narrowing: NO (cached) Compiler for C++ supports arguments -Wno-vla-cxx-extension: NO (cached) ``` This is due to an **unrelated** and more generic compilation failure when testing for the supported arguments, e.g.: ``` Command line: `/tmp/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang++ -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -static-libstdc++ /home/ao2/Collabora/GOO0042/mesa/_build/meson-private/tmpv6_hke9l/testfile.cpp -o /home/ao2/Collabora/GOO0042/mesa/_build/meson-private/tmpv6_hke9l/output.obj -c -Wno-error=c99-designator -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=self-assign -D_FILE_OFFSET_BITS=64 -O0 -fpermissive -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -Wvla-cxx-extension -Wno-vla-cxx-extension` -> 1 stderr: clang++: error: argument unused during compilation: '-static-libstdc++' [-Werror,-Wunused-command-line-argument] ----------- Compiler for C++ supports arguments -Wno-vla-cxx-extension: NO ``` The issue is caused by how the cross compiler is set up by .gitlab-ci/container/create-android-cross-file.sh Allow the cross compiler to still start even when the `-Werror,-Wunused-command-line-argument` error occurs in order to be able to actually detect other arguments: ``` Command line: `/tmp/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang++ -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables --start-no-unused-arguments -static-libstdc++ --end-no-unused-arguments /home/ao2/Collabora/GOO0042/mesa/_build/meson-private/tmpm6eolxed/testfile.cpp -o /home/ao2/Collabora/GOO0042/mesa/_build/meson-private/tmpm6eolxed/output.obj -c -Wno-error=c99-designator -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=self-assign -D_FILE_OFFSET_BITS=64 -O0 -fpermissive -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -Wvla-cxx-extension -Wno-vla-cxx-extension` -> 0 Compiler for C++ supports arguments -Wno-vla-cxx-extension: YES ``` This makes argument detection work again, e.g: ``` Compiler for C++ supports arguments -Wno-array-bounds: YES (cached) Compiler for C++ supports arguments -Wno-overflow: YES Compiler for C++ supports arguments -Wno-c++11-narrowing: YES (cached) Compiler for C++ supports arguments -Wno-vla-cxx-extension: YES (cached) ``` Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12441 Reviewed-by: Daniel Stone Reviewed-by: Valentine Burley Reviewed-by: Rob Clark Part-of: --- .gitlab-ci/container/create-android-cross-file.sh | 2 +- docs/android.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci/container/create-android-cross-file.sh b/.gitlab-ci/container/create-android-cross-file.sh index a29aafe1f65..d815a7e1cf5 100644 --- a/.gitlab-ci/container/create-android-cross-file.sh +++ b/.gitlab-ci/container/create-android-cross-file.sh @@ -18,7 +18,7 @@ cat > "$cross_file" <