#1113237 llvm-toolchain-19: FTBFS with CMake 4

#1113237#5
Date:
2025-08-31 22:59:41 UTC
From:
To:
Dear maintainer,

During a test rebuild for CMake 4, llvm-toolchain-19 failed to rebuild.

Log Summary:
-------------------------------------------------------------------------------
[...]
[2834/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink tahiti-amdgcn-mesa-mesa3d.bc gfx1152-amdgcn-mesa-mesa3d.bc
[2835/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink tahiti-amdgcn-mesa-mesa3d.bc gfx1200-amdgcn-mesa-mesa3d.bc
[2836/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink tahiti-amdgcn-mesa-mesa3d.bc gfx1101-amdgcn-mesa-mesa3d.bc
[2837/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink tahiti-amdgcn-mesa-mesa3d.bc gfx1151-amdgcn-mesa-mesa3d.bc
[2838/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink tahiti-amdgcn-mesa-mesa3d.bc gfx1201-amdgcn-mesa-mesa3d.bc
[2839/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build/prepare_builtins -o nvptx--.bc builtins.opt.nvptx--.bc
[2840/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cedar-r600--.bc palm-r600--.bc
[2841/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build/prepare_builtins -o nvptx64--.bc builtins.opt.nvptx64--.bc
[2842/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cedar-r600--.bc sumo-r600--.bc
[2843/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cedar-r600--.bc redwood-r600--.bc
[2844/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cedar-r600--.bc sumo2-r600--.bc
[2845/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cedar-r600--.bc juniper-r600--.bc
[2846/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cypress-r600--.bc hemlock-r600--.bc
[2847/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build/prepare_builtins -o nvptx64--nvidiacl.bc builtins.opt.nvptx64--nvidiacl.bc
[2848/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink barts-r600--.bc turks-r600--.bc
[2849/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink barts-r600--.bc caicos-r600--.bc
[2850/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/cmake -E create_symlink cayman-r600--.bc aruba-r600--.bc
[2851/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build/prepare_builtins -o nvptx--nvidiacl.bc builtins.opt.nvptx--nvidiacl.bc
[2852/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/llvm-spirv-19 --spirv-max-version=1.1 -o spirv64-mesa3d-.spv builtins.link.spirv64-mesa3d-.bc
[2853/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /usr/bin/llvm-spirv-19 --spirv-max-version=1.1 -o spirv-mesa3d-.spv builtins.link.spirv-mesa3d-.bc
[2854/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/bin/opt -O3 -o builtins.opt.amdgcn--amdhsa.bc builtins.link.amdgcn--amdhsa.bc
[2855/2855] cd /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build && /build/reproducible-path/llvm-toolchain-19-19.1.7/libclc/build/prepare_builtins -o amdgcn--amdhsa.bc builtins.opt.amdgcn--amdhsa.bc
	Command being timed: "ninja -j 5 -v"
	User time (seconds): 1433.95
	System time (seconds): 164.61
	Percent of CPU this job got: 489%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 5:26.24
	Average shared text size (kbytes): 0
	Average unshared data size (kbytes): 0
	Average stack size (kbytes): 0
	Average total size (kbytes): 0
	Maximum resident set size (kbytes): 551460
	Average resident set size (kbytes): 0
	Major (requiring I/O) page faults: 552
	Minor (reclaiming a frame) page faults: 24253758
	Voluntary context switches: 26680
	Involuntary context switches: 8779
	Swaps: 0
	File system inputs: 14584
	File system outputs: 916960
	Socket messages sent: 0
	Socket messages received: 0
	Signals delivered: 0
	Page size (bytes): 4096
	Exit status: 0
touch stamps/debian-libclc-build
Building compiler-rt for wasm32
Using cmake: cmake
mkdir -p "build-wasm/compiler-rt-wasm32"
cmake -B "build-wasm/compiler-rt-wasm32" -S compiler-rt/lib/builtins/ \
	-G Ninja \
	 \
	-DCMAKE_SYSTEM_NAME=Generic \
	-DCMAKE_C_COMPILER_TARGET=wasm32-unknown-unknown \
	-DCMAKE_CXX_COMPILER_TARGET=wasm32-unknown-unknown \
	-DCMAKE_ASM_COMPILER_TARGET=wasm32-unknown-unknown \
	-DCMAKE_C_COMPILER=/build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/bin/clang \
	-DCMAKE_CXX_COMPILER=/build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/bin/clang++ \
	-DCMAKE_C_FLAGS="-O2 -DNDEBUG -g1 -Werror=implicit-function-declaration -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
	-DCMAKE_CXX_FLAGS="-O2 -DNDEBUG -g1 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
	-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id -L/build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/lib" \
	-DCMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id -L/build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/lib" \
	-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id -L/build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/lib" \
	-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-19/lib/clang/19 \
	-DCMAKE_INSTALL_DATADIR=lib \
	-DCMAKE_INSTALL_INCLUDEDIR=include \
	-DLLVM_CMAKE_DIR=/build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/bin/../ \
	-DCOMPILER_RT_STANDALONE_BUILD=ON \
	-DCOMPILER_RT_BAREMETAL_BUILD=ON \
	-DCOMPILER_RT_INCLUDE_TESTS=OFF \
	-DCOMPILER_RT_USE_LIBCXX=OFF \
	-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
	-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=wasm32-unknown-unknown \
	-DCOMPILER_RT_OS_DIR=wasi
-- The C compiler identification is Clang 19.1.7
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for unwind.h
-- Looking for unwind.h - found
-- Looking for rpc/xdr.h
-- Looking for rpc/xdr.h - not found
-- Could NOT find FFI (missing: FFI_LIBRARIES HAVE_FFI_CALL) 
-- Looking for histedit.h
-- Looking for histedit.h - not found
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
-- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR) 
-- Found LibXml2: /usr/lib/aarch64-linux-gnu/libxml2.so (found version "2.14.5")
-- Found CURL: /usr/lib/aarch64-linux-gnu/libcurl.so (found version "8.16.0-rc2")
CMake Error at /build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/lib/cmake/llvm/LLVMExports.cmake:1473 (add_library):
  ADD_LIBRARY called with SHARED option but the target platform does not
  support dynamic linking.
Call Stack (most recent call first):
  /build/reproducible-path/llvm-toolchain-19-19.1.7/build-llvm/tools/clang/stage2-bins/lib/cmake/llvm/LLVMConfig.cmake:371 (include)
  /build/reproducible-path/llvm-toolchain-19-19.1.7/compiler-rt/cmake/Modules/CompilerRTUtils.cmake:312 (find_package)
  CMakeLists.txt:29 (load_llvm_config)
-------------------------------------------------------------------------------

The above is just how the build ends and not necessarily the most relevant part.
If required, the full build log is available here (for the next 30 days):
https://debusine.debian.net/artifact/2406252/

The most likely cause of build failures is the removed backwards compatibility for
CMake versions earlier than 3.5. You can find additional information in my
debian-devel announcement:

https://lists.debian.org/debian-devel/2025/04/msg00310.html

About the archive rebuild: The build was made on debusine.debian.net,
using sbuild.

You can find the build task here:
https://debusine.debian.net/work-request/153971/

If this is really a bug in one of the build-depends, please use
reassign and affects, so that this is still visible in the BTS web
page for this package.

Thanks,
Timo

#1113237#12
Date:
2025-09-01 11:52:09 UTC
From:
To:
I have downgraded the bug to non-RC severity temporarily and reverted
CMake in unstable to version 3.31.6. I plan to re-upgrade in about a
month's time. I realize that despite my April announcement, the upload
to unstable came rather surprising, and I don't want to cause
unnecessary pain.

Also, the build log URL has an unfortunate mistake. The correct URL
should include the workspace, i.e.,

https://debusine.debian.net/debian/developers/artifact/XXXX

CMake 4 will also be available in experimental again, so it can be
used to verify that the bug is fixed.

Cheers
Timo

#1113237#21
Date:
2025-10-25 17:25:32 UTC
From:
To:
I haven't seen any upstream support for cmake 4.x, not even in the trunk
(llvm-toolchain-snapshot). So if you upgrade to cmake 4.x, all LLVM
package stay unbuildable for some unseen time. What do you suggest?

#1113237#30
Date:
2025-11-21 23:12:13 UTC
From:
To:
Hi,

* Matthias Klose <doko@debian.org> [2025-10-25 19:25]:

The actual bug is that LLVM {17,18,19} try to build shared libraries for
WebAssembly, which does not support them. CMP0164 [1] turned this into a
fatal error, and CMake 4 implicitly activates this policy in export
files [2], which is why this became a FTBFS.

I'm going to ask CMake upstream for advice, but ultimately this is
something that LLVM upstream needs to fix. Frankly, I would find it
surprising if they have not addressed this already, and I would further
assume that such a fix can be backported to the older releases.

If that is not possible for some reason, I might be convinced to
introduce a cmake-3 legacy package as hotfix. This cannot be a permanent
solution, though, and I'd rather avoid that maintenance burden
altogether.


Cheers
Timo

[1] https://cmake.org/cmake/help/latest/policy/CMP0164.html
[2] https://gitlab.kitware.com/cmake/cmake/-/commit/10f8c6a2742500ddc708091f194d218a37543129

#1113237#35
Date:
2025-12-01 08:26:29 UTC
From:
To:
Hello again,

On Sat, 22 Nov 2025 00:12:13 +0100 Timo =?utf-8?Q?R=C3=B6hling?=

I've looked into this a bit further and found an upstream issue [1].
In the pull request trying to fix it, upstream notes that you need to
enable shared libraries explicitly (which is what Debian does), so this
actually needs to be fixed by whoever builds for the wasm32 target [2].

My first instinct was to look at the build-wasm/compiler-rt-%" targets
in debian/rules, but I could not determine where the shared library
build is actually activated. Hopefully, someone with a better grasp of
the codebase can pick it up from here.


Cheers
Timo

[1] https://github.com/llvm/llvm-project/issues/118048
[2]
https://github.com/llvm/llvm-project/pull/118262#issuecomment-2561578536
and the follow-up comment

#1113237#42
Date:
2026-06-10 04:34:31 UTC
From:
To:
control: clone -1 -2
control: reassign -2 src:llvm-toolchain-20
control: retitle -2 llvm-toolchain-20: FTBFS with CMake 4: ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking

It also affects llvm-toolchain-20 (currently only in experimental).
Cloning the bug.