[Lldb-commits] [lldb] [lldb][cmake] Set `CMAKE_OSX_SYSROOT` when building debugserver with CMake 4 (PR #138020)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed May 14 10:28:10 PDT 2025


================
@@ -154,6 +154,21 @@ endif()
 
 add_definitions(-DLLDB_USE_OS_LOG)
 
+# Make sure we have the macOS SDK root as mig needs it and will silently
+# fail to generate its output files without it.
+if(CMAKE_OSX_SYSROOT)
+  set(MIG_SYSROOT ${CMAKE_OSX_SYSROOT})
+else()
+  execute_process(COMMAND xcrun --show-sdk-path
+    OUTPUT_VARIABLE MIG_SYSROOT
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+if(NOT MIG_SYSROOT)
+  message(FATAL_ERROR "Unable to obtain macOS SDK root, debugserver cannot be built.")
----------------
JDevlieghere wrote:

Let's make this more specific and actionable. 
```suggestion
  message(FATAL_ERROR "Unable to obtain sysroot required by mig (Mach Interface Generator). Set CMAKE_OSX_SYSROOT to explicitly specify a sysroot.")
```

https://github.com/llvm/llvm-project/pull/138020


More information about the lldb-commits mailing list