Generating Xcode project for swift-lldb with llvm monorepo

How should one go about generating an Xcode project for swift-lldb using the monorepo?

I was using the old swift-lldb repo on the swift-5.0-branch (which had a Xcode project checked in already) and decided to try out the monorepo. I cloned apple/llvm-project and used the commands below on master branch:

  1. git clone
  2. cd llvm-project
  3. cmake -B ./llvm-build -G Ninja \ -C ./lldb/cmake/caches/Apple-lldb-base.cmake \ -DLLVM_ENABLE_PROJECTS="clang;libcxx" ./llvm
  4. cmake -B ./lldb-build -C ./lldb/cmake/caches/Apple-lldb-Xcode.cmake \ -DLLVM_DIR=${PATH_TO_LLVM_CONFIG_CMAKE}

Those steps got me an lldb.xcodeproj for plain lldb. I then tried it for swift-lldb and ran the following:

  1. git clone
  2. cd llvm-project
  3. git checkout swift/master
  4. git clone
  5. git clone
  6. mv swift-cmark cmark
  7. cmake -B ./llvm-build -G Ninja \ -C ./lldb/cmake/caches/Apple-lldb-base.cmake \ -DLLVM_ENABLE_PROJECTS="clang;libcxx,cmark;swift" \ -DLLVM_EXTERNAL_PROJECTS="cmark;swift" \ ./llvm
  8. cmake -B ./lldb-build -C ./lldb/cmake/caches/Apple-lldb-Xcode.cmake \ -DLLVM_DIR=${PATH_TO_LLVM_CONFIG_CMAKE} \ -DSwift_DIR=${PATH_TO_SWIFT_CONFIG_CMAKE}

But this time around command #7 fails with error:
CMake Error at ~/dev/llvm-project/swift/include/swift/Option/CMakeLists.txt:2 (swift_tablegen): Unknown CMake command "swift_tablegen". is outdated and seems to just do the same thing, clone swift and apple/llvm-project.

./swift/utils/build-script -r --lldb-build-with-xcode succeeded in building swift-lldb but does not output an Xcode project.

Xcode version 11.0 (11A420a)
Cmake version 3.15.5
Ninja version 1.9.0

We currently don't have a bot that tests this configuration, so I'm not surprised that it doesn't work out of the box. We do test that you can build a non-swift LLDB out-of-tree with Xcode ( so it can't be too far off.
Perhaps someone else can chime in who has tried this post-monorepo transition.

Oh sorry looks like I had an error in my environment. The above instructions do work. I had Swift_DIR set in my .zshrc to the older swift-lldb directory and for some reason that caused an issue although I would have expected the local define to override it. I removed it from the zshrc and lldb.xcodeproj generates fine now for swift-lldb.

1 Like
Terms of Service

Privacy Policy

Cookie Policy