Source: wasix-libc
Version: 2025.12.24.1+ds-1
Severity: important
Tags: ftbfs patch
User: [email protected]
Usertags: llvm-23-default
Control: affects -1 + src:llvm-defaults
Control: block 1154024 by -1

Hello,

We are going to switch the default LLVM version to 23 (transition bug
#1154024). llvm-defaults 0.75~exp1, in experimental, already points to
23.

wasix-libc fails to build in unstable with it, and builds without it:

clang: error: argument '--target=wasm32-wasi' is deprecated, use
--target=wasm32-wasip1 instead [-Werror,-Wdeprecated]

The Makefile sets TARGET_TRIPLE = $(TARGET_ARCH)-wasi (line 45) and
builds with -Werror (line 385). The warning is new in clang 23. Using
wasm32-wasip1 should fix it.

The attached debdiff keeps the wasm32-wasi triple (it is used for the
installation paths) and adds -Wno-error=deprecated. The build then
fails in check-symbols: clang 23 predefines a few more macros
(__wasip1__, __WCHAR_MIN__, __SIG_ATOMIC_MIN__, ...), so the debdiff
also updates expected/wasm32-wasi/predefined-macros.txt. That second
part must only be uploaded once clang 23 is the default. wasix-libc
builds with both.

To reproduce, with sbuild:

  sbuild -d unstable \
    --extra-repository='deb http://deb.debian.org/debian experimental main' \
    --build-dep-resolver=aptitude \
    --add-depends='clang (>= 1:23~), llvm-dev (>= 1:23~), libclang-dev (>= 
1:23~)' \
    <package>

The --add-depends forces the llvm-defaults packages from experimental
(the default apt resolver won't pick them, aptitude does), everything
else comes from unstable.

The severity will be raised to serious once llvm-defaults 23 is in
unstable.

Cheers,
Sylvestre
diff --git a/debian/patches/llvm-23-predefined-macros.patch b/debian/patches/llvm-23-predefined-macros.patch
new file mode 100644
index 0000000..020d3fd
--- /dev/null
+++ b/debian/patches/llvm-23-predefined-macros.patch
@@ -0,0 +1,49 @@
+Description: Update the expected predefined macros for clang 23
+ clang 23 defines a few more macros (__wasip1__, __WCHAR_MIN__, ...).
+ This must only be applied once clang 23 is the default.
+Author: Sylvestre Ledru <[email protected]>
+Forwarded: not-needed
+Last-Update: 2026-11-15
+---
+Index: wasix-libc-2025.12.24.1+ds/expected/wasm32-wasi/predefined-macros.txt
+===================================================================
+--- wasix-libc-2025.12.24.1+ds.orig/expected/wasm32-wasi/predefined-macros.txt
++++ wasix-libc-2025.12.24.1+ds/expected/wasm32-wasi/predefined-macros.txt
+@@ -5710,6 +5710,7 @@
+ #define __LONG_LONG_MAX__ 9223372036854775807LL
+ #define __LONG_MAX __LONG_MAX__
+ #define __LONG_MAX__ 2147483647L
++#define __MEMORY_SCOPE_CLUSTR 5
+ #define __MEMORY_SCOPE_DEVICE 1
+ #define __MEMORY_SCOPE_SINGLE 4
+ #define __MEMORY_SCOPE_SYSTEM 0
+@@ -5813,6 +5814,8 @@
+ #define __SHRT_MAX__ 32767
+ #define __SID ('S' << 8)
+ #define __SIG_ATOMIC_MAX__ 2147483647L
++#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
++#define __SIG_ATOMIC_TYPE__ long int
+ #define __SIG_ATOMIC_WIDTH__ 32
+ #define __SIZEOF_DOUBLE__ 8
+ #define __SIZEOF_FLOAT__ 4
+@@ -6530,10 +6533,12 @@
+ #define __WASI_WHENCE_END (UINT8_C(2))
+ #define __WASI_WHENCE_SET (UINT8_C(0))
+ #define __WCHAR_MAX__ 2147483647
++#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
+ #define __WCHAR_TYPE__ int
+ #define __WCHAR_WIDTH__ 32
+ #define __WCLONE 0x80000000
+ #define __WINT_MAX__ 2147483647
++#define __WINT_MIN__ (-__WINT_MAX__ - 1)
+ #define __WINT_TYPE__ int
+ #define __WINT_WIDTH__ 32
+ #define __WNOTHREAD 0x20000000
+@@ -6644,6 +6649,7 @@
+ #define __wasilibc___typedef_suseconds_t_h 
+ #define __wasilibc___typedef_time_t_h 
+ #define __wasilibc___typedef_uid_t_h 
++#define __wasip1__ 1
+ #define __wasix__ 1
+ #define __wasix_api_h 
+ #define __wasm 1
diff --git a/debian/patches/llvm-23-wasi-target.patch b/debian/patches/llvm-23-wasi-target.patch
new file mode 100644
index 0000000..5afc314
--- /dev/null
+++ b/debian/patches/llvm-23-wasi-target.patch
@@ -0,0 +1,21 @@
+Description: Fix the build with clang 23
+ clang 23 warns that --target=wasm32-wasi is deprecated, which is fatal
+ with -Werror.
+Author: Sylvestre Ledru <[email protected]>
+Forwarded: no
+Last-Update: 2026-11-15
+---
+Index: wasix-libc-2025.12.24.1+ds/Makefile
+===================================================================
+--- wasix-libc-2025.12.24.1+ds.orig/Makefile
++++ wasix-libc-2025.12.24.1+ds/Makefile
+@@ -377,6 +377,9 @@ LIBC_TOP_HALF_ALL_SOURCES = \
+ CFLAGS = $(EXTRA_CFLAGS)
+ # Set the target.
+ CFLAGS += --target=$(TARGET_TRIPLE)
++# clang 23 deprecates --target=wasm32-wasi in favor of wasm32-wasip1. Keep
++# the triple (it is used for the installation paths), but don't fail on it.
++CFLAGS += -Wno-error=deprecated
+ ASMFLAGS += --target=$(TARGET_TRIPLE)
+ # WebAssembly floating-point match doesn't trap.
+ # TODO: Add -fno-signaling-nans when the compiler supports it.
diff --git a/debian/patches/series b/debian/patches/series
index 553f58c..9addf25 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 0001-Fix-build-errors.patch
+llvm-23-wasi-target.patch
+llvm-23-predefined-macros.patch

Reply via email to