Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6a100fa

Browse filesBrowse files
committed
[lldb][cmake] Error out when building debugserver with CMake 4
CMake 4 no longer sets the `CMAKE_OSX_SYSROOT` variable by default. If you've updated to CMake 4 on macOS (e.g. with brew) and try building LLDB with CMake/ninja, this will yield an error when building debugserver that clang is unable to run since it tries to compile files that don't exist. These files are supposed to be generated by the `mig` process. `mig` needs the `CMAKE_OSX_SYSROOT` variable in order to work and without it, it silently fails to generate the files that later on need to be compiled. This commit sets this SDK path for mig and will fatal error out of config when building debugserver without having set CMAKE_OSX_SYSROOT.
1 parent 76d83e6 commit 6a100fa
Copy full SHA for 6a100fa

File tree

Expand file treeCollapse file tree

1 file changed

+16
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-1
lines changed

‎lldb/tools/debugserver/source/CMakeLists.txt

Copy file name to clipboardExpand all lines: lldb/tools/debugserver/source/CMakeLists.txt
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ endif()
154154

155155
add_definitions(-DLLDB_USE_OS_LOG)
156156

157+
# Make sure we have the macOS SDK root as mig needs it and will silently
158+
# fail to generate its output files without it.
159+
if(CMAKE_OSX_SYSROOT)
160+
set(MIG_SYSROOT ${CMAKE_OSX_SYSROOT})
161+
else()
162+
execute_process(COMMAND xcrun --show-sdk-path
163+
OUTPUT_VARIABLE MIG_SYSROOT
164+
ERROR_QUIET
165+
OUTPUT_STRIP_TRAILING_WHITESPACE)
166+
endif()
167+
168+
if(NOT MIG_SYSROOT)
169+
message(FATAL_ERROR "Unable to obtain macOS SDK root, debugserver cannot be built.")
170+
endif()
171+
157172
if(${CMAKE_OSX_SYSROOT} MATCHES ".Internal.sdk$")
158173
message(STATUS "LLDB debugserver energy support is enabled")
159174
add_definitions(-DLLDB_ENERGY)
@@ -177,7 +192,7 @@ endif()
177192
separate_arguments(MIG_ARCH_FLAGS_SEPARTED NATIVE_COMMAND "${MIG_ARCH_FLAGS}")
178193

179194
add_custom_command(OUTPUT ${generated_mach_interfaces}
180-
VERBATIM COMMAND mig ${MIG_ARCH_FLAGS_SEPARTED} -isysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
195+
VERBATIM COMMAND mig ${MIG_ARCH_FLAGS_SEPARTED} -isysroot ${MIG_SYSROOT} ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
181196
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/MacOSX/dbgnub-mig.defs
182197
)
183198

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.