Skip to content

Commit 866d727

Browse files
committed
Disable libedit on x86_64-macos
I don't know how to fix the build...
1 parent ff1d02d commit 866d727

File tree

1 file changed

+49
-35
lines changed

1 file changed

+49
-35
lines changed

cmake/wasi-sdk-toolchain.cmake

Lines changed: 49 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ set(LLVM_CMAKE_FLAGS "" CACHE STRING "Extra cmake flags to pass to LLVM's build"
55
set(RUST_TARGET "" CACHE STRING "Target to build Rust code for, if not the host")
66
set(WASI_SDK_ARTIFACT "" CACHE STRING "Name of the wasi-sdk artifact being produced")
77

8-
set(LLDB_DEFAULT ON)
9-
# Currently LLDB effectively requires libedit to be usable, and building libedit
10-
# on Windows isn't easy due to usage of `./configure`. Disable LLDB entirely on
11-
# Windows for now.
8+
option(WASI_SDK_LLDB "Include a build of LLDB" ON)
9+
10+
set(LIBEDIT_DEFAULT ON)
11+
# I don't want to deal with running a `./configure` script on Windows, disable
12+
# it by default.
1213
if(WIN32)
13-
set(LLDB_DEFAULT OFF)
14+
set(LIBEDIT_DEFAULT OFF)
15+
endif()
16+
# I don't know how to resolve build failures when building libedit for x86_64
17+
# from arm64 on macos, so disable it for now.
18+
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
19+
set(LIBEDIT_DEFAULT OFF)
1420
endif()
15-
option(LLDB "Include a build of LLDB" ${LLDB_DEFAULT})
21+
option(WASI_SDK_LIBEDIT "Whether or not to build libedit for LLDB" ${LIBEDIT_DEFAULT})
1622

1723
string(REGEX REPLACE "[ ]+" ";" llvm_cmake_flags_list "${LLVM_CMAKE_FLAGS}")
1824

@@ -86,33 +92,7 @@ endif()
8692
# Note that LLDB depends on `libedit` which is more-or-less required to get a
8793
# reasonable command-line experience, so this is built custom here to ensure
8894
# that it's available for LLDB.
89-
if(LLDB)
90-
include(ProcessorCount)
91-
ProcessorCount(nproc)
92-
find_program(MAKE_EXECUTABLE make REQUIRED)
93-
94-
ExternalProject_Add(libedit
95-
URL https://thrysoee.dk/editline/libedit-20251016-3.1.tar.gz
96-
URL_HASH SHA256=21362b00653bbfc1c71f71a7578da66b5b5203559d43134d2dd7719e313ce041
97-
98-
# Without this the build system tries to find and use `aclocal-1.18` where
99-
# with this it doesn't so turn this on.
100-
DOWNLOAD_EXTRACT_TIMESTAMP ON
101-
102-
CONFIGURE_COMMAND
103-
<SOURCE_DIR>/configure
104-
--prefix=${CMAKE_INSTALL_PREFIX}
105-
--enable-pic
106-
--disable-examples
107-
CC=${CMAKE_C_COMPILER}
108-
BUILD_COMMAND
109-
${MAKE_EXECUTABLE} -j${nproc}
110-
111-
USES_TERMINAL_CONFIGURE ON
112-
USES_TERMINAL_BUILD ON
113-
USES_TERMINAL_INSTALL ON
114-
)
115-
95+
if(WASI_SDK_LLDB)
11696
list(APPEND projects lldb)
11797
list(APPEND tools lldb liblldb)
11898
list(APPEND default_cmake_args
@@ -126,9 +106,43 @@ if(LLDB)
126106
-DLLDB_ENABLE_LIBXML2=OFF
127107
-DLLDB_ENABLE_FBSDVMCORE=OFF
128108
-DLLDB_ENABLE_LINUXPTY=OFF
129-
-DLLDB_ENABLE_LIBEDIT=ON
130-
-DLibEdit_ROOT=${CMAKE_INSTALL_PREFIX}
131109
)
110+
111+
if (WASI_SDK_LIBEDIT)
112+
include(ProcessorCount)
113+
ProcessorCount(nproc)
114+
find_program(MAKE_EXECUTABLE make REQUIRED)
115+
ExternalProject_Add(libedit
116+
URL https://thrysoee.dk/editline/libedit-20251016-3.1.tar.gz
117+
URL_HASH SHA256=21362b00653bbfc1c71f71a7578da66b5b5203559d43134d2dd7719e313ce041
118+
119+
# Without this the build system tries to find and use `aclocal-1.18` where
120+
# with this it doesn't so turn this on.
121+
DOWNLOAD_EXTRACT_TIMESTAMP ON
122+
123+
CONFIGURE_COMMAND
124+
<SOURCE_DIR>/configure
125+
--prefix=${CMAKE_INSTALL_PREFIX}
126+
--enable-pic
127+
--disable-examples
128+
CC=${CMAKE_C_COMPILER}
129+
CFLAGS=${libedit_cflags}
130+
LDFLAGS=${libedit_cflags}
131+
BUILD_COMMAND
132+
${MAKE_EXECUTABLE} -j${nproc} V=1
133+
134+
USES_TERMINAL_CONFIGURE ON
135+
USES_TERMINAL_BUILD ON
136+
USES_TERMINAL_INSTALL ON
137+
)
138+
list(APPEND default_cmake_args
139+
-DLLDB_ENABLE_LIBEDIT=ON
140+
-DLibEdit_ROOT=${CMAKE_INSTALL_PREFIX}
141+
)
142+
else()
143+
list(APPEND default_cmake_args -DLLDB_ENABLE_LIBEDIT=OFF)
144+
add_custom_target(libedit)
145+
endif()
132146
else()
133147
add_custom_target(libedit)
134148
endif()

0 commit comments

Comments
 (0)