Skip to content

Commit dc45858

Browse files
committed
ci: fix libc++ std.cppm path for CMake import_std on Clang-21+
CMake detects the std.cppm location relative to where libc++.so is linked (/usr/lib/x86_64-linux-gnu/), producing a normalised path that resolves to /lib/share/libc++/v1/std.cppm. On Debian/Ubuntu the actual file lives under /usr/lib/llvm-N/share/libc++/v1/, so every try_compile inner project fails to generate because the source file does not exist at the expected path. Create a symlink /lib/share/libc++ -> /usr/lib/llvm-N/share/libc++ before the build step so CMake can find the module sources. Only needed when import_std is enabled (the trigger for CMake's module-path detection).
1 parent 216549b commit dc45858

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/ci-freestanding.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ jobs:
118118
shell: bash
119119
run: |
120120
sudo apt install -y libc++-${{ matrix.toolchain.compiler.version }}-dev libc++abi-${{ matrix.toolchain.compiler.version }}-dev libunwind-${{ matrix.toolchain.compiler.version }}-dev
121+
- name: Fix libc++ std.cppm path for CMake
122+
# CMake detects std.cppm relative to where libc++.so is linked
123+
# (/usr/lib/x86_64-linux-gnu/), producing a path like
124+
# /lib/x86_64-linux-gnu/../share/libc++/v1/std.cppm which resolves to
125+
# /lib/share/libc++/v1/std.cppm. On Ubuntu the actual file lives under
126+
# /usr/lib/llvm-N/share/libc++/v1/. Create the expected symlink so that
127+
# CMake's try_compile inner projects can find it.
128+
if: matrix.import_std == 'True' && matrix.toolchain.compiler.type == 'CLANG'
129+
shell: bash
130+
run: |
131+
sudo mkdir -p /lib/share
132+
sudo ln -sfn /usr/lib/llvm-${{ matrix.toolchain.compiler.version }}/share/libc++ /lib/share/libc++
121133
- name: Set up Python
122134
uses: actions/setup-python@v5
123135
with:

0 commit comments

Comments
 (0)