Skip to content

Conversation

@DanielKristofKiss
Copy link
Member

@DanielKristofKiss DanielKristofKiss commented Nov 18, 2024

When configuring CMake with Clang in MSVC mode, Clang can either be invoked with the MSVC style driver (clang-cl) or the GNU style driver (clang). When using the MSVC style driver, CMake sets the CMake variable MSVC (which indicates the kind of command line interface), but when using the GNU style driver, this variable isn't set, while Clang still operates in MSVC mode.

Even though CMake doesn't set the variable MSVC, it still does set CMAKE_C_COMPILER_ARCHITECTURE_ID, which it does set for MSVC and Clang in MSVC mode, but not for Clang in MinGW mode.

For this configuration, use the MSVC style, CMAKE_C_COMPILER_ARCHITECTURE_ID based GetHostTriple implementation.

With this[1] build of clang out of the box cmake fails.
On a Windows on Arm with just cmake, ninja, git, python and clang[1] can be built with[2] this change.
check-clang doesn't work yet.

[1] https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.2/LLVM-19.1.2-woa64.exe
[2] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="compiler-rt" -DLLVM_TARGETS_TO_BUILD="AArch64"  -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF ../llvm && ninja clang compiler-rt

Change-Id: I8849489fc043e63efa57d2d45fb596d422d6baaf
@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Nov 18, 2024
Comment on lines 46 to 57
if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
set( value "aarch64-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
set( value "armv7-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64" )
set( value "x86_64-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86" )
set( value "i686-pc-windows-msvc" )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( value "x86_64-pc-windows-msvc" )
else()
set( value "i686-pc-windows-msvc" )
Copy link
Member

Choose a reason for hiding this comment

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

We usually don't use spaces around parens.

Suggested change
if( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*" )
set( value "aarch64-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*" )
set( value "armv7-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64" )
set( value "x86_64-pc-windows-msvc" )
elseif( CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86" )
set( value "i686-pc-windows-msvc" )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( value "x86_64-pc-windows-msvc" )
else()
set( value "i686-pc-windows-msvc" )
if(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64.*")
set(value "aarch64-pc-windows-msvc")
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*")
set(value "armv7-pc-windows-msvc")
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "x64")
set(value "x86_64-pc-windows-msvc")
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "X86")
set(value "i686-pc-windows-msvc")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(value "x86_64-pc-windows-msvc")
else()
set(value "i686-pc-windows-msvc")

Comment on lines 54 to 57
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( value "x86_64-pc-windows-msvc" )
else()
set( value "i686-pc-windows-msvc" )
Copy link
Member

@petrhosek petrhosek Nov 19, 2024

Choose a reason for hiding this comment

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

Is it safe to assume x86/x64 when CMAKE_C_COMPILER_ARCHITECTURE_ID isn't x86 or x64? Can we report an error instead?

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

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

The PR subject/description reads a bit weird, can you rephrase it?

I guess "build clang with..." means "make sure that building clang works", but it feels a bit terse and off the point here, I'd rather focus on e.g. "fix GetHostTriple for clang in MSVC mode, with the GCC like command line driver mode" or something like that?

(Also, the second sentence in the PR description feels a bit off, that could also use a couple more words to be more readable.)

endif()
else( MSVC )
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS AND CMAKE_C_COMPILER_ID MATCHES "Clang" )
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed here? When operating in MSVC mode, CMake usually sets the MSVC CMake variable, so this should hit the existing codepath at lines 5-18 above? And this is a bit weird, because CMake usually doesn't set COMPILER_ARCHITECTURE_ID for Clang (or GCC), but only for MSVC. I guess CMake might set COMPILER_ARCHITECTURE_ID for Clang-cl when operating in MSVC mode, but if we're invoking it as clang, not clang-cl so that the MSVC variable isn't set, it feels odd that CMake still would be setting COMPILER_ARCHITECTURE_ID.

Also I don't quite see why this needs to be as a separate step within the else() clause here, why can't this be a toplevel case like the other ones?

The condition, CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS also feels quite contrieved for this case. I guess what you want to detect is "clang, targeting windows, probably in msvc mode (as we're past a check for MINGW further up)", and we generally don't want to check for the host unless we need to.

The existing check for CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS is to pick out configurations where we can't run the generic detection shell script below.

Can't we just extend the existing MSVC case at the top, e.g. something like if (MSVC OR (CMAKE_C_COMPILER_ID MATCHES "Clang" AND WIN32 AND CMAKE_C_COMPILER_ARCHITECTURE_ID) or something along those lines, to specifically match the case we're looking for here?

Change-Id: I6e4d6336f639ca4a55829ccd5beab35d5abad339

function( get_host_triple var )
if( MSVC )
if(MSVC OR (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND CMAKE_C_COMPILER_ID MATCHES "Clang"))
Copy link
Member

Choose a reason for hiding this comment

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

This isn't about CMAKE_HOST_SYSTEM_NAME, it's about the target, so we should check CMAKE_SYSTEM_NAME instead - to make it work as expected and intended for cross compilation.

The existing check below which checks CMAKE_HOST_SYSTEM_NAME is for determining whether it will be possible to execute a shell script, where we do need to check the host environment.

@mstorsjo
Copy link
Member

[2] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="compiler-rt" -DLLVM_TARGETS_TO_BUILD="AArch64" -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF ../llvm && ninja clang compiler-rt

In addition to the other request to clarify the wording of the commit message, I think it would be good to spell out the implicit details here; configuring like this, without explicitly telling CMake to use clang-cl, will make it pick the GNU style clang driver, and compiling in MSVC mode with the GNU style driver is generally a less tested configuration.

Change-Id: I998dae17e49db94e1b46aac1b35b68439e0861cb
@DanielKristofKiss DanielKristofKiss changed the title Build clang with the latest released clang on Windows on Arm. Add clang in MSVC mode to GetHostTriple Nov 21, 2024
@mstorsjo
Copy link
Member

The commit message still reads very very weirdly to me - it talks a lot about goals and other stuff, instead of focusing on the actual CMake configuration. (All the other aspects on what tools are available and which sets of tests pass in this configuration, are entirely unrelated to this change.)

May I suggest this instead, which focues on the thing at hand?


Subject: [CMake] Handle clang in MSVC mode in GetHostTriple

When configuring CMake with Clang in MSVC mode, Clang can either be invoked with the MSVC style driver (clang-cl) or the GNU style driver (clang). When using the MSVC style driver, CMake sets the CMake variable MSVC (which indicates the kind of command line interface), but when using the GNU style driver, this variable isn't set, while Clang still operates in MSVC mode.

Even though CMake doesn't set the variable MSVC, it still does set CMAKE_C_COMPILER_ARCHITECTURE_ID, which it does set for MSVC and Clang in MSVC mode, but not for Clang in MinGW mode.

For this configuration, use the MSVC style, CMAKE_C_COMPILER_ARCHITECTURE_ID based GetHostTriple implementation.


Doesn't that capture the thing that this patch actually deals with? If I read the code correctly, GetHostTriple would fail in the same way also on x86, if CMake is invoked with Clang in MSVC mode, with the GNU style driver?

Change-Id: I93d2d9c5bb07f02309724ee1124d8ca7db29ad62
@DanielKristofKiss DanielKristofKiss changed the title Add clang in MSVC mode to GetHostTriple [CMake] Handle clang in MSVC mode in GetHostTriple Nov 26, 2024

function( get_host_triple var )
if( MSVC )
if( MSVC OR (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MINGW AND NOT MSYS))
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, this if condition should be organized something like following:

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
    if(CMAKE_C_COMPILER_ID MATCHES "Clang")
        if(MSVC)
            message(STATUS "Clang is operating in MSVC mode (MSVC style driver: clang-cl).")
        elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID)
            message(STATUS "Clang is operating in MSVC mode (GNU style driver).")
        else()
            message(STATUS "Clang MinGW mode")
        endif()
    elseif(MSVC)
        message(STATUS "Compiler is MSVC (cl compiler).")
endif()

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, something like that would certainly be cleaner - but that would probably also be a much larger refactoring of the cmake code here.

Anyway, I'll accept the change here as I think this version should function correctly, but I don't mind such a restructuring either (maybe ideally as a separate step?).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll take care of that later, just first want to be sure all changes there to run all test, build everything fine. Not sure how much other changes needed... looking at it.

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

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

LGTM, I think this version works as wanted.


function( get_host_triple var )
if( MSVC )
if( MSVC OR (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MINGW AND NOT MSYS))
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, something like that would certainly be cleaner - but that would probably also be a much larger refactoring of the cmake code here.

Anyway, I'll accept the change here as I think this version should function correctly, but I don't mind such a restructuring either (maybe ideally as a separate step?).

@DanielKristofKiss DanielKristofKiss merged commit e9be217 into llvm:main Nov 29, 2024
8 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 29, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime running on omp-vega20-0 while building llvm at step 7 "Add check check-offload".

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

Here is the relevant piece of the build log for the reference
Step 7 (Add check check-offload) failure: test (failure)
******************** TEST 'libomptarget :: amdgcn-amd-amdhsa :: sanitizer/kernel_crash_async.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/clang -fopenmp    -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib  -fopenmp-targets=amdgcn-amd-amdhsa -O3 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c -o /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/clang -fopenmp -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib -fopenmp-targets=amdgcn-amd-amdhsa -O3 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c -o /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a
# note: command had no output on stdout or stderr
# RUN: at line 3
/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=1 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp 2>&1 | /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=TRACE
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=1 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp
# note: command had no output on stdout or stderr
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=TRACE
# note: command had no output on stdout or stderr
# RUN: at line 4
/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp 2>&1 | /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=CHECK
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp
# note: command had no output on stdout or stderr
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=CHECK
# note: command had no output on stdout or stderr
# RUN: at line 5
/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/clang -fopenmp    -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib  -fopenmp-targets=amdgcn-amd-amdhsa -O3 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c -o /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a -g
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/clang -fopenmp -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test -I /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib -L /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -nogpulib -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib -fopenmp-targets=amdgcn-amd-amdhsa -O3 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c -o /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./lib/libomptarget.devicertl.a -g
# note: command had no output on stdout or stderr
# RUN: at line 6
/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=1 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp 2>&1 | /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=TRACE
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=1 /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp
# note: command had no output on stdout or stderr
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=TRACE
# note: command had no output on stdout or stderr
# RUN: at line 7
/home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp 2>&1 | /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=CHECK
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/not --crash /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/runtimes/runtimes-bins/offload/test/amdgcn-amd-amdhsa/sanitizer/Output/kernel_crash_async.c.tmp
# note: command had no output on stdout or stderr
# executed command: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.build/./bin/FileCheck /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c --check-prefixes=CHECK
# .---command stderr------------
# | /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c:39:11: error: CHECK: expected string not found in input
# | // CHECK: Kernel {{[0-9]}}: {{.*}} (__omp_offloading_{{.*}}_main_l29)
# |           ^
# | <stdin>:1:1: note: scanning from here
# | Display only launched kernel:
# | ^
# | <stdin>:2:23: note: possible intended match here
# | Kernel 'omp target in main @ 29 (__omp_offloading_802_b38838e_main_l29)'
# |                       ^
# | 
# | Input file: <stdin>
# | Check file: /home/ompworker/bbot/openmp-offload-amdgpu-runtime/llvm.src/offload/test/sanitizer/kernel_crash_async.c
# | 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 29, 2024

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (177 of 2049)
PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (178 of 2049)
XFAIL: lldb-api :: commands/platform/connect/TestPlatformConnect.py (179 of 2049)
UNSUPPORTED: lldb-api :: commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py (180 of 2049)
UNSUPPORTED: lldb-api :: commands/platform/process/list/TestProcessList.py (181 of 2049)
UNSUPPORTED: lldb-api :: commands/platform/sdk/TestPlatformSDK.py (182 of 2049)
UNSUPPORTED: lldb-api :: commands/process/attach-resume/TestAttachResume.py (183 of 2049)
PASS: lldb-api :: commands/platform/process/launch/TestPlatformProcessLaunch.py (184 of 2049)
UNSUPPORTED: lldb-api :: commands/process/attach/attach_denied/TestAttachDenied.py (185 of 2049)
PASS: lldb-api :: commands/process/continue_to_bkpt/TestContinueToBkpts.py (186 of 2049)
FAIL: lldb-api :: commands/process/detach-resumes/TestDetachResumes.py (187 of 2049)
******************** TEST 'lldb-api :: commands/process/detach-resumes/TestDetachResumes.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --arch aarch64 --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --skip-category=watchpoint C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\process\detach-resumes -p TestDetachResumes.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision e9be21786c972de93206599d4e06b79c2ca8f772)
  clang revision e9be21786c972de93206599d4e06b79c2ca8f772
  llvm revision e9be21786c972de93206599d4e06b79c2ca8f772
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
ls: cannot access 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\commands\process\detach-resumes\TestDetachResumes.test_detach_resumes\exit_file_1732876764': No such file or directory
ls: cannot access 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\commands\process\detach-resumes\TestDetachResumes.test_detach_resumes\exit_file_1732876764': No such file or directory
ls: cannot access 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\commands\process\detach-resumes\TestDetachResumes.test_detach_resumes\exit_file_1732876764': No such file or directory
ls: cannot access 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\commands\process\detach-resumes\TestDetachResumes.test_detach_resumes\exit_file_1732876764': No such file or directory
ls: cannot access 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\commands\process\detach-resumes\TestDetachResumes.test_detach_resumes\exit_file_1732876764': No such file or directory
ls: cannot access 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\commands\process\detach-resumes\TestDetachResumes.test_detach_resumes\exit_file_1732876764': No such file or directory
FAIL: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_detach_resumes (TestDetachResumes.DetachResumesTestCase.test_detach_resumes)

======================================================================

FAIL: test_detach_resumes (TestDetachResumes.DetachResumesTestCase.test_detach_resumes)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\process\detach-resumes\TestDetachResumes.py", line 59, in test_detach_resumes

    lldbutil.wait_for_file_on_target(self, exit_file_path)


DavidSpickett added a commit that referenced this pull request Nov 29, 2024
Caused by #116701.

Seems like a lot of arguments to repeat, so just use a plain endif().
@mstorsjo
Copy link
Member

mstorsjo commented Jan 2, 2025

Btw, there's another way of detecting Clang in MSVC mode, while using the GNU command line. Currently we do this as (WIN32 AND NOT MINGW) or similar, but there's also CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" which should trigger for both clang (in MSVC mode) and clang-cl, but not clang in mingw mode. See https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_SIMULATE_ID.html for docs, and https://discourse.cmake.org/t/clang-on-windows-detected-with-msvc-interface/3470/3 for a concrete example.

@DanielKristofKiss
Copy link
Member Author

@mstorsjo addressed in #122914

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.

6 participants