This is an archive of the discontinued LLVM Phabricator instance.

[Fuchsia] Add LLDB options to stage 1 cmake.
ClosedPublic

Authored by mysterymath on Mar 6 2023, 4:05 PM.

Details

Summary

LLVM_ENABLE_PROJECTS is automatically forwarded from stage 1 builds to
stage 2 builds, so setting FUCHSIA_ENABLE_LLDB has no effect on
two-stage builds.

Instead, add FUCHSIA_ENABLE_LLDB to the stage one build as well.

This also disables curses and libedit by default for now in both stage1
and stage 2 builds; these should be opt-in.

Diff Detail

Event Timeline

mysterymath created this revision.Mar 6 2023, 4:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 4:05 PM
Herald added a subscriber: abrachet. · View Herald Transcript
mysterymath requested review of this revision.Mar 6 2023, 4:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 4:05 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
haowei added inline comments.Mar 6 2023, 4:15 PM
clang/cmake/caches/Fuchsia.cmake
167

You probably need a string(REPLACE ";" "|" value "${_FUCHSIA_ENABLE_PROJECTS}") after append a value. As by default cmake use | to separate items.
But do you actually need a _FUCHSIA_ENABLE_PROJECTS variable, couldn't you just append lldb at the end of LLVM_ENABLE_PROJECTS here?

mysterymath added inline comments.Mar 7 2023, 10:18 AM
clang/cmake/caches/Fuchsia.cmake
167

You probably need a string(REPLACE ";" "|" value "${_FUCHSIA_ENABLE_PROJECTS}") after append a value. As by default cmake use | to separate items.

Hm? CMake's list separator is the semicolon: https://cmake.org/cmake/help/latest/command/list.html

But do you actually need a _FUCHSIA_ENABLE_PROJECTS variable, couldn't you just append lldb at the end of LLVM_ENABLE_PROJECTS here?

(list APPEND ...) doesn't work on cache variables. If I were to use the (set CACHE FORCE) idiom instead, it would append lldb each time a configure occurs. The idea here is to have FUCHSIA_ENABLE_LLDB affect the defaults, but to respect whatever's already in the CMake cache otherwise.

haowei accepted this revision.Mar 7 2023, 10:50 AM

LGTM, but please wait @phosek to approve it.

clang/cmake/caches/Fuchsia.cmake
167

Hm? CMake's list separator is the semicolon: https://cmake.org/cmake/help/latest/command/list.html

I see, I am wrong. I thought it is similar to passthrough cmake variables to the next stage.

(list APPEND ...) doesn't work on cache variables. If I were to use the (set CACHE FORCE) idiom instead, it would append lldb each time a configure occurs. The idea here is to have FUCHSIA_ENABLE_LLDB affect the defaults, but to respect whatever's already in the CMake cache otherwise.

I see. I didn't know that.

This revision is now accepted and ready to land.Mar 7 2023, 10:50 AM

LLVM_ENABLE_PROJECTS is automatically forwarded from stage 1 builds to
stage 2 builds, so setting FUCHSIA_ENABLE_LLDB has no effect on
two-stage builds.

That shouldn't be the case, do you know where it's being passed through?

This revision was automatically updated to reflect the committed changes.
phosek added a comment.Mar 7 2023, 3:13 PM

LLVM_ENABLE_PROJECTS is automatically forwarded from stage 1 builds to
stage 2 builds, so setting FUCHSIA_ENABLE_LLDB has no effect on
two-stage builds.

That shouldn't be the case, do you know where it's being passed through?

Looks like it's being passed through here https://github.com/llvm/llvm-project/blob/c0e9c55db3b6a2a1287ba96ef3d378b97b72714a/clang/CMakeLists.txt#L669 which was introduced by D40258. I'll see if we can remove that.