Skip to content

[llvm][cmake] Quote CMAKE_CXX_COMPILER_ID in string comparison #133332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025

Conversation

Michael137
Copy link
Member

We're seeing following configuration error when building the runtimes target on our buildbots:

CMake Error at /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if):
  if given arguments:

    "STREQUAL" "MSVC"

  Unknown arguments specified
Call Stack (most recent call first):
  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)
  CMakeLists.txt:175 (include)

If I understand correctly this happens because ${CMAKE_CXX_COMPILER_ID} is empty. Quoting it should make the comparison work for those cases.

We're seeing following configuration error when building the `runtimes` target on our buildbots:
```
CMake Error at /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if):
  if given arguments:

    "STREQUAL" "MSVC"

  Unknown arguments specified
Call Stack (most recent call first):
  /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)
  CMakeLists.txt:175 (include)
```

If I understand correctly this happens because ${CMAKE_CXX_COMPILER_ID}
is empty. Quoting it should make the comparison work for those cases.
@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Mar 27, 2025
@Michael137
Copy link
Member Author

@@ -11,7 +11,7 @@ endmacro()

# MSVC and /arch:AVX is untested and have created problems before. See:
# https://github.com/llvm/llvm-project/issues/54645
if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL MSVC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the error message, it's likely that CMAKE_CXX_COMPILER_ID as a variable is empty or not defined. Expanding the variable here effectively turns this into if( STREQUAL MSVC), which is why the error complains about only seeing those two.

I would recommend changing your solution to:
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"). This makes it clear that the former is a variable and the latter is a string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! That seems to also be how we do it elsewhere in the codebase

@bulbazord bulbazord merged commit fc33aa9 into llvm:main Mar 27, 2025
7 of 9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 28, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/15044

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: functionalities/ptrauth_diagnostics/BLRAA_error/TestPtrauthBLRAADiagnostic.py (563 of 2112)
UNSUPPORTED: lldb-api :: functionalities/ptrauth_diagnostics/BRAA_error/TestPtrauthBRAADiagnostic.py (564 of 2112)
UNSUPPORTED: lldb-api :: functionalities/ptrauth_diagnostics/LDRAA_error/TestPtrauthLDRAADiagnostic.py (565 of 2112)
UNSUPPORTED: lldb-api :: functionalities/ptrauth_diagnostics/brkC47x_code/TestPtrauthBRKc47xDiagnostic.py (566 of 2112)
UNSUPPORTED: lldb-api :: functionalities/ptrauth_diagnostics/brkC47x_x16_invalid/TestPtrauthBRKc47xX16Invalid.py (567 of 2112)
UNSUPPORTED: lldb-api :: functionalities/rerun_and_expr_dylib/TestRerunAndExprDylib.py (568 of 2112)
PASS: lldb-api :: functionalities/progress_reporting/TestProgressReporting.py (569 of 2112)
PASS: lldb-api :: functionalities/process_group/TestChangeProcessGroup.py (570 of 2112)
PASS: lldb-api :: functionalities/rerun/TestRerun.py (571 of 2112)
PASS: lldb-api :: functionalities/reverse-execution/TestReverseContinueNotSupported.py (572 of 2112)
FAIL: lldb-api :: functionalities/rerun_and_expr/TestRerunAndExpr.py (573 of 2112)
******************** TEST 'lldb-api :: functionalities/rerun_and_expr/TestRerunAndExpr.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/rerun_and_expr -p TestRerunAndExpr.py
--
Exit Code: -11

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision fc33aa9684243dcce84b81f11c004061350b945a)
  clang revision fc33aa9684243dcce84b81f11c004061350b945a
  llvm revision fc33aa9684243dcce84b81f11c004061350b945a
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_dsym (TestRerunAndExpr.TestRerunExpr) (test case does not fall in any category of interest for this run) 
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_dwarf (TestRerunAndExpr.TestRerunExpr)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_dwo (TestRerunAndExpr.TestRerunExpr)
----------------------------------------------------------------------
Ran 3 tests in 0.975s

OK (skipped=1)

--

********************
UNSUPPORTED: lldb-api :: functionalities/scripted_process/TestStackCoreScriptedProcess.py (574 of 2112)
UNSUPPORTED: lldb-api :: functionalities/scripted_process_empty_memory_region/TestScriptedProcessEmptyMemoryRegion.py (575 of 2112)
UNSUPPORTED: lldb-api :: functionalities/set-data/TestSetData.py (576 of 2112)
PASS: lldb-api :: functionalities/return-value/TestReturnValue.py (577 of 2112)
PASS: lldb-api :: functionalities/show_location/TestShowLocationDwarf5.py (578 of 2112)
PASS: lldb-api :: functionalities/scripted_process/TestScriptedProcess.py (579 of 2112)
PASS: lldb-api :: functionalities/signal/handle-abrt/TestHandleAbort.py (580 of 2112)
PASS: lldb-api :: functionalities/signal/TestSendSignal.py (581 of 2112)
PASS: lldb-api :: functionalities/reverse-execution/TestReverseContinueWatchpoints.py (582 of 2112)
PASS: lldb-api :: functionalities/signal/handle-segv/TestHandleSegv.py (583 of 2112)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants