From 39f4464e902d787a0e8219dc334b9b2bff1ddf16 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 9 Jan 2023 23:47:22 +0100 Subject: [PATCH 01/12] Disable libc++-$(LLVM_VERSION)-dev-wasm32 on old Debian & Ubuntu --- debian/changelog | 1 + debian/rules | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/debian/changelog b/debian/changelog index 07f39815..5664b068 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ llvm-toolchain-14 (1:14.0.6-11) UNRELEASED; urgency=medium [ Sylvestre Ledru ] * Update SV to 4.6.2 + * Disable libc++-$(LLVM_VERSION)-dev-wasm32 on old Debian & Ubuntu [ Gianfranco Costamagna ] * Fix riscv64 build by adding spirv again (from @paravoid) diff --git a/debian/rules b/debian/rules index 09fc3b79..48557e32 100755 --- a/debian/rules +++ b/debian/rules @@ -373,6 +373,12 @@ else PROJECTS+=;lldb endif +LIBCXX_WASM_ENABLE=yes +LIBCXX_WASM_DISABLE_DISTRO := bionic buster focal bullseye +ifeq (,$(filter-out $(WASM_DISABLE_DISTRO), $(DISTRO))) + LIBCXX_WASM_ENABLE=no +endif + ifneq (,$(filter $(DISTRO),stretch)) # Don't enable lld python for old distros STAGE_ALL_CMAKE_EXTRA += -DLLDB_ENABLE_PYTHON=OFF @@ -510,6 +516,12 @@ preconfigure: if test "$(LLVM_SPIRV_INSTALLED)" = "yes"; then \ sed -i -e "s|#spv\ ||g" debian/libclc-$(LLVM_VERSION).install; \ fi + + # disable libc++-X.Y-dev-wasm32.install.in on old distro + if test "$(LIBCXX_WASM_ENABLE)" = "no"; then \ + echo "" > debian/libc++-$(LLVM_VERSION)-dev-wasm32.install; \ + fi + if test "$(DISTRO)" = "stretch"; then \ echo "" > debian/python3-lldb-$(LLVM_VERSION).install; \ fi @@ -750,6 +762,9 @@ build-wasm/compiler-rt-%: build-wasm/libcxx-%-wasi: cpu = $(@:build-wasm/libcxx-%-wasi=%) build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% +ifeq (${LIBCXX_WASM_ENABLE},yes) + @echo "Skipping libcxx-*-wasi on this distro $(DISTRO)" +else @echo "Building libcxx for $(cpu)" @echo "Using cmake: $(CMAKE_BIN)" @@ -825,6 +840,7 @@ build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% -DLIBCXXABI_HAS_EXTERNAL_THREAD_API:BOOL=OFF \ -DLIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY:BOOL=OFF ninja -C "$@" $(NJOBS) $(VERBOSE) +endif # Build compiler-rt for wasm32 and wasm64. Build libcxx only for wasm32, as # libcxx requires wasi-libc, which only exists for wasm32 right now. From dc2648a7f6a350d664411eec8898baaefd36f09c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 13:35:22 +0100 Subject: [PATCH 02/12] also disable the libcxx-wasm32-wasi install --- debian/rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules b/debian/rules index 48557e32..5a74f853 100755 --- a/debian/rules +++ b/debian/rules @@ -1010,7 +1010,9 @@ endif DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/compiler-rt-wasm32 install DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/compiler-rt-wasm64 install +ifeq (${LIBCXX_WASM_ENABLE},yes) DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/libcxx-wasm32-wasi install +endif # Rename binaries mkdir -p $(DEB_INST)/usr/bin/ From 41c7732ff3829d73472de8eabd8b25c113d383d0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 20:21:11 +0100 Subject: [PATCH 03/12] try a different technic to check --- debian/rules | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 5a74f853..41d6ce72 100755 --- a/debian/rules +++ b/debian/rules @@ -1010,9 +1010,10 @@ endif DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/compiler-rt-wasm32 install DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/compiler-rt-wasm64 install -ifeq (${LIBCXX_WASM_ENABLE},yes) - DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/libcxx-wasm32-wasi install -endif + if test -d build-wasm/libcxx-wasm32-wasi; then \ + DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C build-wasm/libcxx-wasm32-wasi install; \ + fi + # Rename binaries mkdir -p $(DEB_INST)/usr/bin/ From 1de026337906bb4cbe994ed0982334abaca508f8 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 20:56:28 +0100 Subject: [PATCH 04/12] also disable libc++abi-14-dev-wasm32 --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index 41d6ce72..b65490e5 100755 --- a/debian/rules +++ b/debian/rules @@ -520,6 +520,7 @@ preconfigure: # disable libc++-X.Y-dev-wasm32.install.in on old distro if test "$(LIBCXX_WASM_ENABLE)" = "no"; then \ echo "" > debian/libc++-$(LLVM_VERSION)-dev-wasm32.install; \ + echo "" > debian/libc++abi-$(LLVM_VERSION)-dev-wasm32.install; \ fi if test "$(DISTRO)" = "stretch"; then \ From e1e0815e41ccbbcbac288e4a4ca1a8db44aa08f0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 21:54:45 +0100 Subject: [PATCH 05/12] LIBCXX_WASM_ENABLE=no --- debian/rules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/rules b/debian/rules index b65490e5..25b34024 100755 --- a/debian/rules +++ b/debian/rules @@ -481,6 +481,7 @@ preconfigure: @echo "LLVM_VERSION_SNAPSHOT=$(LLVM_VERSION_SNAPSHOT)" @echo "PATH=$(PATH)" @echo "LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)" + @echo "LIBCXX_WASM_ENABLE=$(LIBCXX_WASM_ENABLE)" for f in debian/*.in; do \ f2=$$(echo $$f | sed 's/\.in$$//;s/X\.Y/$(LLVM_VERSION)/'); \ From 2e851b26476f3151318a4c39216e879404fbe68a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 22:13:52 +0100 Subject: [PATCH 06/12] fix var name --- debian/rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 25b34024..ecfcd55a 100755 --- a/debian/rules +++ b/debian/rules @@ -374,8 +374,9 @@ else endif LIBCXX_WASM_ENABLE=yes + LIBCXX_WASM_DISABLE_DISTRO := bionic buster focal bullseye -ifeq (,$(filter-out $(WASM_DISABLE_DISTRO), $(DISTRO))) +ifeq (,$(filter-out $(LIBCXX_WASM_DISABLE_DISTRO), $(DISTRO))) LIBCXX_WASM_ENABLE=no endif From 8df7ca8d3c55088e93081464e99185b57ea1c402 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 23:26:27 +0100 Subject: [PATCH 07/12] try another way --- debian/rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index ecfcd55a..fc592e0f 100755 --- a/debian/rules +++ b/debian/rules @@ -374,7 +374,6 @@ else endif LIBCXX_WASM_ENABLE=yes - LIBCXX_WASM_DISABLE_DISTRO := bionic buster focal bullseye ifeq (,$(filter-out $(LIBCXX_WASM_DISABLE_DISTRO), $(DISTRO))) LIBCXX_WASM_ENABLE=no @@ -763,11 +762,12 @@ build-wasm/compiler-rt-%: -DCOMPILER_RT_OS_DIR=wasi ninja -C "$@" $(NJOBS) $(VERBOSE) -build-wasm/libcxx-%-wasi: cpu = $(@:build-wasm/libcxx-%-wasi=%) +ifeq ($(LIBCXX_WASM_ENABLE, "no") build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% -ifeq (${LIBCXX_WASM_ENABLE},yes) @echo "Skipping libcxx-*-wasi on this distro $(DISTRO)" else +build-wasm/libcxx-%-wasi: cpu = $(@:build-wasm/libcxx-%-wasi=%) +build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% @echo "Building libcxx for $(cpu)" @echo "Using cmake: $(CMAKE_BIN)" From 7090685fb67fe1d8f919452b555d5df844ab505e Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 23:32:54 +0100 Subject: [PATCH 08/12] fix syntax --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index fc592e0f..82e2beac 100755 --- a/debian/rules +++ b/debian/rules @@ -762,7 +762,7 @@ build-wasm/compiler-rt-%: -DCOMPILER_RT_OS_DIR=wasi ninja -C "$@" $(NJOBS) $(VERBOSE) -ifeq ($(LIBCXX_WASM_ENABLE, "no") +ifeq ($(LIBCXX_WASM_ENABLE, "no")) build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% @echo "Skipping libcxx-*-wasi on this distro $(DISTRO)" else From 93ecb8e79c3fc566a1d1fd46430cd464fc79ed4c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 10 Jan 2023 23:44:20 +0100 Subject: [PATCH 09/12] fix syntax (bis) --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 82e2beac..fa8772b6 100755 --- a/debian/rules +++ b/debian/rules @@ -762,7 +762,7 @@ build-wasm/compiler-rt-%: -DCOMPILER_RT_OS_DIR=wasi ninja -C "$@" $(NJOBS) $(VERBOSE) -ifeq ($(LIBCXX_WASM_ENABLE, "no")) +ifeq ($(LIBCXX_WASM_ENABLE), no) build-wasm/libcxx-%-wasi: build-wasm/compiler-rt-% @echo "Skipping libcxx-*-wasi on this distro $(DISTRO)" else From f647ae31eba3a0d3286c5015c2d3575b533ec301 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 11 Jan 2023 00:02:16 +0100 Subject: [PATCH 10/12] document the why --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index fa8772b6..27a031dc 100755 --- a/debian/rules +++ b/debian/rules @@ -375,6 +375,9 @@ endif LIBCXX_WASM_ENABLE=yes LIBCXX_WASM_DISABLE_DISTRO := bionic buster focal bullseye +# Either wasi-libc doesn't exist / too old +# or we have this bug +# https://sourceware.org/bugzilla/show_bug.cgi?id=27558 ifeq (,$(filter-out $(LIBCXX_WASM_DISABLE_DISTRO), $(DISTRO))) LIBCXX_WASM_ENABLE=no endif From 1d75785e942f6d9d2b984dd9b89a57e67c327bf0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 11 Jan 2023 00:10:04 +0100 Subject: [PATCH 11/12] add a check --- debian/rules | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/rules b/debian/rules index 27a031dc..013d19d9 100755 --- a/debian/rules +++ b/debian/rules @@ -1189,14 +1189,16 @@ else endif endif dh_install --fail-missing -# Move the libc+ abi files from libc++ to libc++-abi for the wasm32 packages +# Move the libc++ abi files from libc++ to libc++-abi for the wasm32 packages # These packages are arch: all, so only do so when the packages are built ifneq (,$(filter libc++-$(LLVM_VERSION)-dev-wasm32, $(shell dh_listpackages))) mkdir -p $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1 - mv $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h \ - $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h - mv $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/cxxabi.h \ - $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/cxxabi.h + if test -f $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h; then \ + mv $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h \ + $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/__cxxabi_config.h; \ + mv $(CURDIR)/debian/libc++-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/cxxabi.h \ + $(CURDIR)/debian/libc++abi-$(LLVM_VERSION)-dev-wasm32/usr/lib/llvm-$(LLVM_VERSION)/include/wasm32-wasi/c++/v1/cxxabi.h; \ + fi endif From 99ff46f9010dc5f93b136e3f6a06797fe4c0945f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 11 Jan 2023 10:58:40 +0100 Subject: [PATCH 12/12] Disable libc++-$(LLVM_VERSION)-dev-wasm32 on old Debian & Ubuntu: bionic buster focal bullseye jammy either wasi-libc isn't available or too old or we face bug https://sourceware.org/bugzilla/show_bug.cgi?id=27558 --- debian/changelog | 7 +++++-- debian/rules | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5664b068..5e17e02f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,12 +2,15 @@ llvm-toolchain-14 (1:14.0.6-11) UNRELEASED; urgency=medium [ Sylvestre Ledru ] * Update SV to 4.6.2 - * Disable libc++-$(LLVM_VERSION)-dev-wasm32 on old Debian & Ubuntu + * Disable libc++-$(LLVM_VERSION)-dev-wasm32 on old Debian & Ubuntu: + bionic buster focal bullseye jammy + either wasi-libc isn't available or too old or we face bug + https://sourceware.org/bugzilla/show_bug.cgi?id=27558 [ Gianfranco Costamagna ] * Fix riscv64 build by adding spirv again (from @paravoid) - -- Sylvestre Ledru Mon, 02 Jan 2023 13:54:51 +0100 + -- Sylvestre Ledru Wed, 11 Jan 2023 10:58:32 +0100 llvm-toolchain-14 (1:14.0.6-10) unstable; urgency=medium diff --git a/debian/rules b/debian/rules index 013d19d9..0611d7e1 100755 --- a/debian/rules +++ b/debian/rules @@ -374,7 +374,7 @@ else endif LIBCXX_WASM_ENABLE=yes -LIBCXX_WASM_DISABLE_DISTRO := bionic buster focal bullseye +LIBCXX_WASM_DISABLE_DISTRO := bionic buster focal bullseye jammy # Either wasi-libc doesn't exist / too old # or we have this bug # https://sourceware.org/bugzilla/show_bug.cgi?id=27558