Set CMAKE_OSX_SYSROOT when building lldb (#4274)

CMake 4 no longer sets the CMAKE_OSX_SYSROOT variable by default, causing the
lldb build to fail after all GitHub-hosted runners have been upgraded to
CMake 4.

As a workaround, the variable is set using CMake command line options. There
is a PR to fix this issue in the llvm-project:
https://github.com/llvm/llvm-project/pull/138020. We might want to remove
this workaround after that PR has been merged.
This commit is contained in:
liang.he 2025-05-14 10:39:06 +08:00 committed by GitHub
parent 065cc72350
commit 5c7f64bcc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,6 +172,12 @@ jobs:
python3 ci/validate_lldb.py --port 1239 --lldb core/deps/wamr-lldb/bin/lldb --wamr wamr-debug/iwasm --verbose python3 ci/validate_lldb.py --port 1239 --lldb core/deps/wamr-lldb/bin/lldb --wamr wamr-debug/iwasm --verbose
working-directory: . working-directory: .
# Define CMAKE_OSX_SYSROOT to avoid the error:
# no such file or directory: 'llvm-project/build/tools/lldb/tools/debugserver/source/mach_excServer.c'
# no such file or directory: 'llvm-project/build/tools/lldb/tools/debugserver/source/mach_excUser.c'
#
# This workaround should be removed when the issue is fixed in llvm-project:
# - https://github.com/llvm/llvm-project/pull/138020/
- name: build lldb macos - name: build lldb macos
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos') if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
run: | run: |
@ -179,6 +185,7 @@ jobs:
mkdir -p wamr-lldb mkdir -p wamr-lldb
cmake -S ./llvm -B build \ cmake -S ./llvm -B build \
-G Ninja \ -G Ninja \
-DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) \
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \ -DCMAKE_INSTALL_PREFIX=../wamr-lldb \
-DCMAKE_BUILD_TYPE:STRING="Release" \ -DCMAKE_BUILD_TYPE:STRING="Release" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \