This is an archive of the discontinued LLVM Phabricator instance.

Fix "Unknown arguments specified" to if in lldb
ClosedPublic

Authored by ctetreau on Oct 20 2020, 10:07 AM.

Diff Detail

Event Timeline

ctetreau created this revision.Oct 20 2020, 10:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 10:07 AM
ctetreau requested review of this revision.Oct 20 2020, 10:07 AM

What's the motivation for this?

What's the motivation for this?

This is preventing me from generating the build system:

-- SWIG 2 or later is required for Python support in LLDB but could not be found
CMake Error at [redacted]/lldb/cmake/modules/FindPythonAndSwig.cmake:49 (if):
  if given arguments:

    "3.8.0" "VERSION_GREATER_EQUAL" "3.7" "AND" "" "VERSION_LESS" "4.0" "AND" "WIN32" "AND" "(" "1" "OR" "(" "STREQUAL" "Debug" ")" ")"

  Unknown arguments specified
Call Stack (most recent call first):
  [redacted]/lldb/cmake/modules/LLDBConfig.cmake:48 (find_package)
  [redacted]/lldb/cmake/modules/LLDBConfig.cmake:59 (add_optional_dependency)
  [redacted]/lldb/CMakeLists.txt:29 (include)


-- Configuring incomplete, errors occurred!

There are two issues:

STREQUAL accepts variables on the LHS, so the braces are unneccesary. The real issue though is that uppercase_CMAKE_BUILD_TYPE is not defined at this point. I could define it, but the case of the possible values of CMAKE_BUILD_TYPE are well defined so there's no reason to.

The real issue though is that uppercase_CMAKE_BUILD_TYPE is not defined at this point. I could define it, but the case of the possible values of CMAKE_BUILD_TYPE are well defined so there's no reason to.

I thought it was CMake that provided uppercase_CMAKE_BUILD_TYPE but it's llvm itself. I'm not sure how we end up here without that variable set, wiht in-tree builds we inherit all the LLVM variables and in standalone builds AddLLVM should take care of it. Given that the rest of LLVM uses the uppercase variant and thus accepts values like "DEBUG" I'm not a fan of being more strict here if only for the sake of consistency.

ctetreau planned changes to this revision.Oct 20 2020, 11:59 AM

After experimenting a bit, it seems that if you pass -DCMAKE_BUILD_TYPE=RELEASE, then the value of CMAKE_BUILD_TYPE will also be uppercase. This might represent a "good reason" to use the uppercase_CMAKE_BUILD_TYPE version. I need to think on this a bit, but I may end up just making sure that this variable is defined.

ctetreau updated this revision to Diff 299491.Oct 20 2020, 3:22 PM

restore use of uppercase_CMAKE_BUILD_TYPE

OK, for now, I've restored the use of uppercase_CMAKE_BUILD_TYPE. It looks like this does get set, and it's just the empty string on my machine because windows.

I'd like to see it get removed, but this commit is about fixing the build.

labath accepted this revision.Oct 21 2020, 12:31 AM
labath added a subscriber: labath.

Sorry about the breakage.

lldb/cmake/modules/FindPythonAndSwig.cmake
51

Maybe add quotes here instead of dropping the ${}. I'm not really sure which one is more idiomatic, but that's what I did for the other variables (SWIG_VERSION, etc.) -- it seems I just forgot about this one.

This revision is now accepted and ready to land.Oct 21 2020, 12:31 AM
This revision was automatically updated to reflect the committed changes.