Skip to content
  • Antonio Ospite's avatar
    b016f218
    ci/android: fix meson C++ cross-compiler argument detection · b016f218
    Antonio Ospite authored and Marge Bot's avatar Marge Bot committed
    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: #12441
    
    
    Reviewed-by: default avatarDaniel Stone <daniels@collabora.com>
    Reviewed-by: default avatarValentine Burley <valentine.burley@collabora.com>
    Reviewed-by: default avatarRob Clark <robclark@freedesktop.org>
    Part-of: <!33013>
    b016f218
    ci/android: fix meson C++ cross-compiler argument detection
    Antonio Ospite authored and Marge Bot's avatar Marge Bot committed
    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: #12441
    
    
    Reviewed-by: default avatarDaniel Stone <daniels@collabora.com>
    Reviewed-by: default avatarValentine Burley <valentine.burley@collabora.com>
    Reviewed-by: default avatarRob Clark <robclark@freedesktop.org>
    Part-of: <!33013>
Loading