From cc5c4c98d7e5945a74759a1f40c26239bd7a4b1a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 16 Mar 2026 11:16:00 -0500 Subject: [PATCH] Try to disable ncurses dep for libedit (#615) I'm shamelessly copying what [AlmaLinux does](https://git.almalinux.org/rpms/libedit/src/commit/3f0893c4cd8e0cbb2f556d2fad48326c9c037a6c/SPECS/libedit.spec#L44-L48), so let's try that... Closes #613 --- cmake/wasi-sdk-toolchain.cmake | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cmake/wasi-sdk-toolchain.cmake b/cmake/wasi-sdk-toolchain.cmake index ef977c3..d433b9c 100644 --- a/cmake/wasi-sdk-toolchain.cmake +++ b/cmake/wasi-sdk-toolchain.cmake @@ -109,6 +109,22 @@ if(WASI_SDK_LLDB) -DLLDB_ENABLE_LINUXPTY=OFF ) + set(extra_configure_commands) + if(CMAKE_SYSTEM_NAME STREQUAL Linux) + set(extra_configure_commands + # By default it looks like `libedit` tries to link to `libncurses.so` and + # such on Linux. This is problematic as systems may not have that + # installed. Turns out though at least for AlmaLinux [1] they just edit + # makefile and pkg-config info and it works out. Who knew! I thought + # one of the millions of lines in `./configure` would take care of this + # but apparently we're still resorting to editing things raw... + # + # [1]: https://git.almalinux.org/rpms/libedit/src/commit/3f0893c4cd8e0cbb2f556d2fad48326c9c037a6c/SPECS/libedit.spec#L44-L48 + COMMAND sed -i "s/lncurses/ltinfo/" src/Makefile + COMMAND sed -i "s/ -lncurses//" libedit.pc + ) + endif() + if (WASI_SDK_LIBEDIT) include(ProcessorCount) ProcessorCount(nproc) @@ -129,10 +145,13 @@ if(WASI_SDK_LLDB) --prefix=${wasi_tmp_install} --enable-pic --disable-examples + --disable-static + --disable-silent-rules CC=${CMAKE_C_COMPILER} LDFLAGS=${libedit_ldflags} + ${extra_configure_commands} BUILD_COMMAND - ${MAKE_EXECUTABLE} -j${nproc} V=1 + ${MAKE_EXECUTABLE} -j${nproc} USES_TERMINAL_CONFIGURE ON USES_TERMINAL_BUILD ON