From 2e8571d8fd804dae095c2a4daed26bb289397ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 11 Feb 2026 14:34:55 +0100 Subject: [PATCH] package: enable _LIBCPP_REMOVE_TRANSITIVE_INCLUDES for all libc++ builds. Which makes libc++ since version 16 not use transitive includes for backwards compatibility, both for faster build times and to detect if some code is missing a transitive include (which could blow up for the user even w/o this macro defined, as compiling with -std=c++23 also removes quite a lot such includes). This affects Android, macOS/iOS and Emscripten. On the CI right now all VMs use older libc++, which means it does nothing, but it's done there anyway to future-proof. Locally on Arch it affects the Android and Emscripten builds already, as well as an explicit clang + libc++ build. --- package/archlinux/PKGBUILD-android-arm64 | 4 ++++ package/archlinux/PKGBUILD-clang-libc++ | 5 +++- package/archlinux/PKGBUILD-emscripten-wasm | 4 ++++ .../archlinux/PKGBUILD-emscripten-wasm-webgl2 | 4 ++++ package/ci/android-x86-gles.sh | 7 ++++++ package/ci/android-x86-vulkan.sh | 7 ++++++ package/ci/circleci.yml | 24 +++++++++++++++---- package/ci/emscripten.sh | 7 ++++++ package/ci/ios-simulator-gles.sh | 7 ++++++ 9 files changed, 64 insertions(+), 5 deletions(-) diff --git a/package/archlinux/PKGBUILD-android-arm64 b/package/archlinux/PKGBUILD-android-arm64 index 89fabfc2b..2077e373a 100644 --- a/package/archlinux/PKGBUILD-android-arm64 +++ b/package/archlinux/PKGBUILD-android-arm64 @@ -35,6 +35,10 @@ build() { # CLICOLOR_FORCE=1: https://github.com/ninja-build/ninja/issues/2196 cmake .. \ -DCMAKE_BUILD_TYPE=Release \ + `# Make libc++ remove transitive includes, both for faster build` \ + `# times and to detect if we're missing a transitive include. Works` \ + `# with libc++ 16+, which is used by NDK r26+.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DCMAKE_COLOR_DIAGNOSTICS=ON \ -DMAGNUM_WITH_VK=ON \ -DMAGNUM_WITH_ANYAUDIOIMPORTER=OFF \ diff --git a/package/archlinux/PKGBUILD-clang-libc++ b/package/archlinux/PKGBUILD-clang-libc++ index d727af301..a56417e87 100644 --- a/package/archlinux/PKGBUILD-clang-libc++ +++ b/package/archlinux/PKGBUILD-clang-libc++ @@ -25,7 +25,10 @@ build() { -DCMAKE_CROSS_CONFIGS=all \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -fno-omit-frame-pointer" \ -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + `# Make libc++ remove transitive includes, both for faster build` \ + `# times and to detect if we're missing a transitive include.` \ + `# Works with libc++ 16+, which is used by NDK r26+.` \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++ -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DCMAKE_EXE_LINKER_FLAGS=-lc++abi \ -G "Ninja Multi-Config" fi diff --git a/package/archlinux/PKGBUILD-emscripten-wasm b/package/archlinux/PKGBUILD-emscripten-wasm index 128fad0fa..59ef093b4 100644 --- a/package/archlinux/PKGBUILD-emscripten-wasm +++ b/package/archlinux/PKGBUILD-emscripten-wasm @@ -51,6 +51,10 @@ build() { cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/lib/emscripten/system \ + `# Make libc++ remove transitive includes, both for faster build` \ + `# times and to detect if we're missing a transitive include. Works` \ + `# with libc++ 16+.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DCMAKE_COLOR_DIAGNOSTICS=ON \ -DMAGNUM_DEPLOY_PREFIX=/srv/http/emscripten \ -DMAGNUM_WITH_AUDIO=ON \ diff --git a/package/archlinux/PKGBUILD-emscripten-wasm-webgl2 b/package/archlinux/PKGBUILD-emscripten-wasm-webgl2 index 06ffac0ed..b192bce26 100644 --- a/package/archlinux/PKGBUILD-emscripten-wasm-webgl2 +++ b/package/archlinux/PKGBUILD-emscripten-wasm-webgl2 @@ -51,6 +51,10 @@ build() { cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/lib/emscripten/system \ + `# Make libc++ remove transitive includes, both for faster build` \ + `# times and to detect if we're missing a transitive include. Works` \ + `# with libc++ 16+.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DCMAKE_COLOR_DIAGNOSTICS=ON \ -DMAGNUM_DEPLOY_PREFIX=/srv/http/emscripten-webgl2 \ -DMAGNUM_TARGET_GLES2=OFF \ diff --git a/package/ci/android-x86-gles.sh b/package/ci/android-x86-gles.sh index 806bf42f9..58e2af9d0 100755 --- a/package/ci/android-x86-gles.sh +++ b/package/ci/android-x86-gles.sh @@ -54,6 +54,13 @@ cmake .. \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ -DCMAKE_PREFIX_PATH=$HOME/deps \ -DCMAKE_BUILD_TYPE=Release \ + `# Make libc++ remove transitive includes, both for faster build times` \ + `# and to detect if we're missing a transitive include. Works with` \ + `# libc++ 16+, which is used by NDK r26+ (i.e., will get used next time` \ + `# the android image is bumped). Not doing this for the Corrade build,` \ + `# as that'd only add extra friction with no possibility of fixing from` \ + `# here.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \ -DMAGNUM_TARGET_GLES2=$TARGET_GLES2 \ -DMAGNUM_WITH_AUDIO=OFF \ diff --git a/package/ci/android-x86-vulkan.sh b/package/ci/android-x86-vulkan.sh index 87de50972..47438ce10 100755 --- a/package/ci/android-x86-vulkan.sh +++ b/package/ci/android-x86-vulkan.sh @@ -55,6 +55,13 @@ cmake .. \ -DCMAKE_ANDROID_STL_TYPE=c++_static \ -DCMAKE_FIND_ROOT_PATH="/opt/android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot;$HOME/deps" \ -DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=/i686-linux-android/29 \ + `# Make libc++ remove transitive includes, both for faster build times` \ + `# and to detect if we're missing a transitive include. Works with` \ + `# libc++ 16+, which is used by NDK r26+ (i.e., will get used next time` \ + `# the android image is bumped). Not doing this for the Corrade build,` \ + `# as that'd only add extra friction with no possibility of fixing from` \ + `# here.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ -DCMAKE_PREFIX_PATH=$HOME/deps \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/package/ci/circleci.yml b/package/ci/circleci.yml index bd5bd70b1..d9c1f92b9 100644 --- a/package/ci/circleci.yml +++ b/package/ci/circleci.yml @@ -671,7 +671,11 @@ jobs: macos-gl: executor: xcode-14_3 environment: - CMAKE_CXX_FLAGS: --coverage + # Make libc++ remove transitive includes, both for faster build times and + # to detect if we're missing a transitive include. Works with libc++ 16+, + # which is used by Xcode 15 (i.e., will get used on the next CircleCI + # executor update). + CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES CONFIGURATION: Debug EXTRA_OPTS: > -DMAGNUM_WITH_WINDOWLESSCGLAPPLICATION=ON @@ -690,7 +694,11 @@ jobs: macos-gles3: executor: xcode-14_3 environment: - CMAKE_CXX_FLAGS: --coverage + # Make libc++ remove transitive includes, both for faster build times and + # to detect if we're missing a transitive include. Works with libc++ 16+, + # which is used by Xcode 15 (i.e., will get used on the next CircleCI + # executor update). + CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES CONFIGURATION: Debug EXTRA_OPTS: > -DMAGNUM_WITH_WINDOWLESSEGLAPPLICATION=ON @@ -712,7 +720,11 @@ jobs: macos-vulkan: executor: xcode-14_3 environment: - CMAKE_CXX_FLAGS: --coverage + # Make libc++ remove transitive includes, both for faster build times and + # to detect if we're missing a transitive include. Works with libc++ 16+, + # which is used by Xcode 15 (i.e., will get used on the next CircleCI + # executor update). + CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES steps: - install-base-macos: extra: sdl2 glfw wget @@ -746,7 +758,11 @@ jobs: # For some reason on the 15.1 image OpenAL hangs on startup. Skip those # tests. EXTRA_EXCLUDED_TESTS: "|ALTest" - CMAKE_CXX_FLAGS: --coverage + # Make libc++ remove transitive includes, both for faster build times and + # to detect if we're missing a transitive include. Works with libc++ 16+, + # which is used by Xcode 15 (i.e., will get used on the next CircleCI + # executor update). + CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES CONFIGURATION: Debug steps: # macos-gl tests with dynamic MoltenVK diff --git a/package/ci/emscripten.sh b/package/ci/emscripten.sh index 2f7c36dff..41e09019e 100755 --- a/package/ci/emscripten.sh +++ b/package/ci/emscripten.sh @@ -32,6 +32,13 @@ cmake .. \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ -DCMAKE_FIND_ROOT_PATH=$HOME/deps \ + `# Make libc++ remove transitive includes, both for faster build times` \ + `# and to detect if we're missing a transitive include. Works with` \ + `# libc++ 16+, which is used by Emscripten 3.1.18+ (i.e., will get used` \ + `# next time emsdk is bumped). Not doing this for the Corrade build, as` \ + `# that'd only add extra friction with no possibility of fixing from` \ + `# here.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DMAGNUM_WITH_AUDIO=ON \ -DMAGNUM_WITH_VK=OFF \ -DMAGNUM_WITH_EMSCRIPTENAPPLICATION=ON \ diff --git a/package/ci/ios-simulator-gles.sh b/package/ci/ios-simulator-gles.sh index 3ef327804..db5c770ea 100755 --- a/package/ci/ios-simulator-gles.sh +++ b/package/ci/ios-simulator-gles.sh @@ -56,6 +56,13 @@ cmake .. \ -DCMAKE_PREFIX_PATH="$HOME/deps" \ -DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ + `# Make libc++ remove transitive includes, both for faster build times` \ + `# and to detect if we're missing a transitive include. Works with` \ + `# libc++ 16+, which is used by Xcode 15 (i.e., will get used on the` \ + `# next CircleCI executor update). Not doing this for the Corrade build` \ + `# as that'd only add extra friction with no possibility of fixing from` \ + `# here.` \ + -DCMAKE_CXX_FLAGS="-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES" \ -DMAGNUM_TARGET_GLES2=$TARGET_GLES2 \ -DMAGNUM_WITH_AUDIO=ON \ -DMAGNUM_WITH_VK=OFF \