Skip to content

[CMake] Do not set CMP0116 explicitly to old #90385

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 11 commits into from
Apr 26, 2025

Conversation

boomanaiden154
Copy link
Contributor

CMP0116 was originally set to old to get rid of warnings. However, this behavior is now set to new by default with the minimum CMake version that LLVM requires so does not produce any warnings, and setting it explicitly to old does produce a warning in newer CMake versions. Due to these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something breaks.

Partially fixes #83727.

@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Apr 28, 2024
@zero9178
Copy link
Member

Last I checked, setting this to new causes issues with cmake consuming TableGens dep files. I don't fully remember the sympton but I think it'd either claim that a TableGen command is always out of date or it would not capture all dependencies and therefore not rereun a TableGen command if an included file changed.

There was a PR that would address this here #72333. Is this still needed/the case?

@boomanaiden154
Copy link
Contributor Author

Last I checked, setting this to new causes issues with cmake consuming TableGens dep files. I don't fully remember the sympton but I think it'd either claim that a TableGen command is always out of date or it would not capture all dependencies and therefore not rereun a TableGen command if an included file changed.

There was a PR that would address this here #72333. Is this still needed/the case?

Looks like it's still needed. I didn't realize this was an issue. Thanks for bringing this up! I'll make sure that gets fixed before we merge this/merge this as part of the fix.

CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version that LLVM
requires so does not produce any warnings, and setting it explicitly to old
does produce a warning in newer CMake versions. Due to these reasons, remove
this check for now.

Splitting off from removing the CMP0114 check just in case something breaks.

This also removes two instances of a workaround related to the old
behavior of CMP0116.

Partially fixes llvm#83727.
@boomanaiden154
Copy link
Contributor Author

Updated to fix the issues based on the patch in #72333.

@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2024

@llvm/pr-subscribers-mlir

Author: Aiden Grossman (boomanaiden154)

Changes

CMP0116 was originally set to old to get rid of warnings. However, this behavior is now set to new by default with the minimum CMake version that LLVM requires so does not produce any warnings, and setting it explicitly to old does produce a warning in newer CMake versions. Due to these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something breaks.

Partially fixes #83727.


Full diff: https://github.com/llvm/llvm-project/pull/90385.diff

3 Files Affected:

  • (modified) cmake/Modules/CMakePolicy.cmake (-6)
  • (modified) llvm/cmake/modules/TableGen.cmake (+5-10)
  • (modified) mlir/cmake/modules/AddMLIR.cmake (+5-8)
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index f19dfd71657171..f6ecc40d8f1279 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -1,11 +1,5 @@
 # CMake policy settings shared between LLVM projects
 
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
-  cmake_policy(SET CMP0116 OLD)
-endif()
-
 # MSVC debug information format flags are selected via
 # CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
 # embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index ffcc718b47775f..d2ff1cfa553b39 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -23,18 +23,13 @@ function(tablegen project ofn)
 
   # Use depfile instead of globbing arbitrary *.td(s) for Ninja.
   if(CMAKE_GENERATOR MATCHES "Ninja")
-    # Make output path relative to build.ninja, assuming located on
-    # ${CMAKE_BINARY_DIR}.
     # CMake emits build targets as relative paths but Ninja doesn't identify
-    # absolute path (in *.d) as relative path (in build.ninja)
-    # Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
-    file(RELATIVE_PATH ofn_rel
-      ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
+    # absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
+    # CMake handles this discrepancy for us.
     set(additional_cmdline
-      -o ${ofn_rel}
-      -d ${ofn_rel}.d
-      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-      DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
+      -o ${ofn}
+      -d ${ofn}.d
+      DEPFILE ${ofn}.d
       )
     set(local_tds)
     set(global_tds)
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index a3324705c525ce..bbe5976d7a3e76 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -47,15 +47,12 @@ function(_pdll_tablegen project ofn)
     # Make output path relative to build.ninja, assuming located on
     # ${CMAKE_BINARY_DIR}.
     # CMake emits build targets as relative paths but Ninja doesn't identify
-    # absolute path (in *.d) as relative path (in build.ninja)
-    # Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.
-    file(RELATIVE_PATH ofn_rel
-      ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
+    # absolute path (in *.d) as relative path (in build.ninja). Post CMP0116,
+    # CMake handles this discrepancy for us.
     set(additional_cmdline
-      -o ${ofn_rel}
-      -d ${ofn_rel}.d
-      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-      DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.d
+      -o ${ofn}
+      -d ${ofn}.d
+      DEPFILE ${ofn}.d
       )
     set(local_tds)
     set(global_tds)

Copy link
Contributor

@chapuni chapuni left a comment

Choose a reason for hiding this comment

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

Let me reconfirm later. apparently looks good.

Note, when I introduced it, CMake didn't have CMP0116 NEW behavior.

@boomanaiden154
Copy link
Contributor Author

@chapuni Are you able to take another look at this when you get a chance? Thanks.

Copy link
Contributor

@chapuni chapuni left a comment

Choose a reason for hiding this comment

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

@boomanaiden154 Sorry for delay. I was busy the last week.
I just wanted to reconfirm in my local tree, but it'd be fine now!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 26, 2025

LLVM Buildbot has detected a new failure on builder polly-x86_64-linux-noassert running on polly-x86_64-gce1 while building cmake,llvm,mlir at step 5 "build".

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

Here is the relevant piece of the build log for the reference
Step 5 (build) failure: 'ninja' (failure)
...
[240/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/RecordName.cpp.o
[241/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/RecordSerialization.cpp.o
[242/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/SimpleTypeSerializer.cpp.o
[243/4235] Linking CXX executable bin/llvm-min-tblgen
[244/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/StringsAndChecksums.cpp.o
[245/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/SymbolDumper.cpp.o
[246/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/SymbolRecordHelpers.cpp.o
[247/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/SymbolSerializer.cpp.o
[248/4235] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/SymbolRecordMapping.cpp.o
[249/4235] Building GenVT.inc...
FAILED: include/llvm/CodeGen/GenVT.inc /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/CodeGen/GenVT.inc 
cd /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/CodeGen && /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/bin/llvm-min-tblgen -gen-vt -I /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include/llvm/CodeGen -I/home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include -I/home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include/llvm/CodeGen/ValueTypes.td --write-if-changed -o GenVT.inc -d GenVT.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include/llvm/CodeGen /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/CodeGen /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/CodeGen/GenVT.inc.d /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/CMakeFiles/d/df18015f0091e4744504a0cceb0e8716be0db9938a20d71427e1f1d8fa53f80d.d
[250/4235] Building Attributes.inc...
FAILED: include/llvm/IR/Attributes.inc /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/IR/Attributes.inc 
cd /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/IR && /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/bin/llvm-min-tblgen -gen-attrs -I /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include/llvm/IR -I/home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include -I/home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include/llvm/IR/Attributes.td --write-if-changed -o Attributes.inc -d Attributes.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.src/llvm/include/llvm/IR /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/IR /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/include/llvm/IR/Attributes.inc.d /home/worker/buildbot-workers/polly-x86_64-gce1/rundir/llvm.obj/CMakeFiles/d/edfe9896b2f8fb9e30f453cc441ed9c51cc3a938f797e2fccb320a5c548ec02e.d
[251/4235] Building IntrinsicsR600.h...
[252/4235] Building IntrinsicsBPF.h...
[253/4235] Building IntrinsicEnums.inc...
[254/4235] Building IntrinsicImpl.inc...
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 26, 2025

LLVM Buildbot has detected a new failure on builder polly-x86_64-linux-plugin running on polly-x86_64-gce1 while building cmake,llvm,mlir at step 5 "build".

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

Here is the relevant piece of the build log for the reference
Step 5 (build) failure: 'ninja' (failure)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 26, 2025

LLVM Buildbot has detected a new failure on builder clang-with-thin-lto-ubuntu running on as-worker-92 while building cmake,llvm,mlir at step 6 "build-stage1-compiler".

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

Here is the relevant piece of the build log for the reference
Step 6 (build-stage1-compiler) failure: build (failure)
...
13.888 [6160/20/376] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o
13.908 [6160/19/377] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o
13.959 [6160/18/378] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/Record.cpp.o
13.963 [6159/18/379] Building CXX object third-party/benchmark/src/CMakeFiles/benchmark.dir/benchmark.cc.o
13.988 [6158/18/380] Linking CXX static library lib/libLLVMTableGen.a
13.989 [6156/19/381] Linking CXX static library lib/libbenchmark.a
14.001 [6155/19/382] Linking CXX static library lib/libbenchmark_main.a
14.010 [6155/18/383] Linking CXX static library lib/libLLVMTableGenBasic.a
14.189 [6155/17/384] Linking CXX executable bin/llvm-min-tblgen
14.202 [6128/43/385] Building Attributes.inc...
FAILED: include/llvm/IR/Attributes.inc /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/IR/Attributes.inc 
cd /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/IR && /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/llvm-min-tblgen -gen-attrs -I /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/IR -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/IR/Attributes.td --write-if-changed -o Attributes.inc -d Attributes.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/IR /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1 /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/IR /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/IR/Attributes.inc.d /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/CMakeFiles/d/6dccb7c2f0ff39fa60308525dfc5f6362867ca046c649d9c2e090201dac5b371.d
14.204 [6128/42/386] Building GenVT.inc...
FAILED: include/llvm/CodeGen/GenVT.inc /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/CodeGen/GenVT.inc 
cd /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/CodeGen && /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/bin/llvm-min-tblgen -gen-vt -I /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/CodeGen -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.td --write-if-changed -o GenVT.inc -d GenVT.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/CodeGen /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1 /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/CodeGen /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include/llvm/CodeGen/GenVT.inc.d /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/CMakeFiles/d/cff587678f59ae7cc7b9fad7406c3a84c5127848515760b35681a12801323982.d
14.211 [6128/41/387] Building ACC.inc...
14.212 [6128/40/388] Building ACC.h.inc...
14.216 [6128/39/389] Building OMP.h.inc...
14.221 [6128/38/390] Building OMP.inc...
14.477 [6128/37/391] Building CXX object lib/FileCheck/CMakeFiles/LLVMFileCheck.dir/FileCheck.cpp.o
14.634 [6128/36/392] Building IntrinsicsHexagon.h...
14.634 [6128/35/393] Building IntrinsicsLoongArch.h...
14.634 [6128/34/394] Building IntrinsicsAArch64.h...
14.635 [6128/33/395] Building IntrinsicsAMDGPU.h...
14.635 [6128/32/396] Building IntrinsicsMips.h...
14.638 [6128/31/397] Building IntrinsicEnums.inc...
14.639 [6128/30/398] Building IntrinsicsX86.h...
14.639 [6128/29/399] Building IntrinsicsARM.h...
14.641 [6128/28/400] Building IntrinsicsPowerPC.h...
14.642 [6128/27/401] Building IntrinsicsNVPTX.h...
14.646 [6128/26/402] Building IntrinsicsBPF.h...
14.665 [6128/25/403] Building IntrinsicsDirectX.h...
14.675 [6128/24/404] Building CXX object unittests/Bitstream/CMakeFiles/BitstreamTests.dir/BitstreamWriterTest.cpp.o
14.692 [6128/23/405] Building IntrinsicsSPIRV.h...
14.700 [6128/22/406] Building IntrinsicsVE.h...
14.712 [6128/21/407] Building IntrinsicsXCore.h...
14.712 [6128/20/408] Building IntrinsicImpl.inc...
14.855 [6128/19/409] Building IntrinsicsRISCV.h...
14.855 [6128/18/410] Building IntrinsicsS390.h...
14.866 [6128/17/411] Building IntrinsicsR600.h...
14.866 [6128/16/412] Building IntrinsicsWebAssembly.h...
15.024 [6128/15/413] Building ARMTargetParserDef.inc...
15.097 [6128/14/414] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
15.142 [6128/13/415] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o
15.226 [6128/12/416] Building CXX object unittests/DebugInfo/MSF/CMakeFiles/DebugInfoMSFTests.dir/MSFBuilderTest.cpp.o
15.232 [6128/11/417] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/RandomAccessVisitorTest.cpp.o
15.281 [6128/10/418] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/TypeIndexDiscoveryTest.cpp.o
15.348 [6128/9/419] Building CXX object unittests/DebugInfo/MSF/CMakeFiles/DebugInfoMSFTests.dir/MappedBlockStreamTest.cpp.o
16.185 [6128/8/420] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/MveEmitter.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 26, 2025

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building cmake,llvm,mlir at step 4 "build stage 1".

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

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja -j4' (failure)
...
[213/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/CodeViewError.cpp.o
[214/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/AppendingTypeTableBuilder.cpp.o
[215/6069] Linking CXX static library lib/libLLVMDebugInfoMSF.a
[216/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/CodeViewRecordIO.cpp.o
[217/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/ContinuationRecordBuilder.cpp.o
[218/6069] Linking CXX executable bin/llvm-min-tblgen
[219/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/CVSymbolVisitor.cpp.o
[220/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/CVTypeVisitor.cpp.o
[221/6069] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/DebugChecksumsSubsection.cpp.o
[222/6069] Building GenVT.inc...
FAILED: include/llvm/CodeGen/GenVT.inc /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/include/llvm/CodeGen/GenVT.inc 
cd /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/include/llvm/CodeGen && /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-min-tblgen -gen-vt -I /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/include/llvm/CodeGen -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/include -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/include /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/include/llvm/CodeGen/ValueTypes.td --write-if-changed -o GenVT.inc -d GenVT.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/include/llvm/CodeGen /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1 /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/include/llvm/CodeGen /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/include/llvm/CodeGen/GenVT.inc.d /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/CMakeFiles/d/832dec0b379bad612f2b0f3d8216034fd02c7ae7bfcbe019f385c9bbec7ec6a4.d
[223/6069] Building IntrinsicsPowerPC.h...
[224/6069] Building IntrinsicsNVPTX.h...
[225/6069] Building IntrinsicsMips.h...
ninja: build stopped: subcommand failed.

@boomanaiden154
Copy link
Contributor Author

FYI, this works fine in my side.

It's definitely broken in some cases.

I've been able to reproduce the failure on Ubuntu 22.04 with CMake 3.22.1. The issue seems to be around Running the cmake -E cmake_transform_depfile command upon building tablegen targets. Running that with a more recent CMake (current ToT) works just fine. Now it's just a matter of figuring out what exactly the fix was and what CMake version it landed in.

@boomanaiden154
Copy link
Contributor Author

It looks like the issue was present all the way through v3.22 (including v3.22.6) and is gone by the time v3.23.0 lands. I'm going to bisect.

@boomanaiden154
Copy link
Contributor Author

It ended up bisecting down to e04a352cca523eba2ac0d60063a3799f5bb1c69e in CMake, which about makes sense given the commit description:

Depfile parsing: enhance compatibility with GNU Make

I think we might just need to use fall back behavior for CMake <3.23.0. I'll push the patch for that and see how it goes.

boomanaiden154 added a commit that referenced this pull request Apr 26, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 26, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building cmake,llvm,mlir at step 7 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/90/95' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-3852-90-95.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=95 GTEST_SHARD_INDEX=90 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


jyli0116 pushed a commit to jyli0116/llvm-project that referenced this pull request Apr 28, 2025
CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something
breaks.

Partially fixes llvm#83727.
jyli0116 pushed a commit to jyli0116/llvm-project that referenced this pull request Apr 28, 2025
This reverts commit ab405fb.

This caused quite a few buildbot failures that need further
investigation.
jyli0116 pushed a commit to jyli0116/llvm-project that referenced this pull request Apr 28, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Apr 30, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 30, 2025

LLVM Buildbot has detected a new failure on builder clang-with-lto-ubuntu running on as-worker-91 while building cmake,llvm,mlir at step 6 "build-stage1-compiler".

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

Here is the relevant piece of the build log for the reference
Step 6 (build-stage1-compiler) failure: build (failure)
...
13.443 [6158/23/375] Linking CXX executable bin/split-file
13.461 [6158/22/376] Linking CXX executable bin/llvm-undname
13.482 [6158/21/377] Linking CXX executable bin/reduce-chunk-list
13.483 [6158/20/378] Linking CXX executable bin/yaml-bench
13.747 [6158/19/379] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/Record.cpp.o
13.774 [6157/19/380] Linking CXX static library lib/libLLVMTableGen.a
13.794 [6155/20/381] Linking CXX static library lib/libLLVMTableGenBasic.a
13.914 [6155/19/382] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangOpenCLBuiltinEmitter.cpp.o
13.964 [6155/18/383] Linking CXX executable bin/llvm-min-tblgen
13.978 [6128/44/384] Building Attributes.inc...
FAILED: include/llvm/IR/Attributes.inc /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/IR/Attributes.inc 
cd /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/IR && /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/bin/llvm-min-tblgen -gen-attrs -I /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/IR -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/IR/Attributes.td --write-if-changed -o Attributes.inc -d Attributes.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/IR /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1 /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/IR /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/IR/Attributes.inc.d /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/CMakeFiles/d/57e88667026e60e61f85bd5e21947de3c5bfb40bf148cbfc7a307192dc7ac993.d
13.982 [6128/43/385] Building ACC.inc...
13.983 [6128/42/386] Building GenVT.inc...
FAILED: include/llvm/CodeGen/GenVT.inc /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/CodeGen/GenVT.inc 
cd /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/CodeGen && /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/bin/llvm-min-tblgen -gen-vt -I /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/CodeGen -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/CodeGen/ValueTypes.td --write-if-changed -o GenVT.inc -d GenVT.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/CodeGen /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1 /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/CodeGen /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include/llvm/CodeGen/GenVT.inc.d /home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/CMakeFiles/d/abb1528cdd0a34126f7dd280ff60fff9015952116ae2d7b2d43e83470c3c71e2.d
13.987 [6128/41/387] Building ACC.h.inc...
13.989 [6128/40/388] Building OMP.h.inc...
13.995 [6128/39/389] Building OMP.inc...
14.239 [6128/38/390] Building CXX object lib/FileCheck/CMakeFiles/LLVMFileCheck.dir/FileCheck.cpp.o
14.303 [6128/37/391] Building CXX object unittests/Bitstream/CMakeFiles/BitstreamTests.dir/BitstreamWriterTest.cpp.o
14.398 [6128/36/392] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/SveEmitter.cpp.o
14.402 [6128/35/393] Building IntrinsicsDirectX.h...
14.402 [6128/34/394] Building IntrinsicsARM.h...
14.402 [6128/33/395] Building IntrinsicsNVPTX.h...
14.403 [6128/32/396] Building IntrinsicsRISCV.h...
14.403 [6128/31/397] Building IntrinsicsR600.h...
14.406 [6128/30/398] Building IntrinsicsBPF.h...
14.407 [6128/29/399] Building IntrinsicsSPIRV.h...
14.407 [6128/28/400] Building IntrinsicsAArch64.h...
14.407 [6128/27/401] Building IntrinsicEnums.inc...
14.408 [6128/26/402] Building IntrinsicsPowerPC.h...
14.408 [6128/25/403] Building IntrinsicsLoongArch.h...
14.411 [6128/24/404] Building IntrinsicsX86.h...
14.413 [6128/23/405] Building IntrinsicsHexagon.h...
14.432 [6128/22/406] Building IntrinsicsMips.h...
14.463 [6128/21/407] Building IntrinsicsVE.h...
14.470 [6128/20/408] Building IntrinsicsS390.h...
14.471 [6128/19/409] Building IntrinsicImpl.inc...
14.497 [6128/18/410] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/RandomAccessVisitorTest.cpp.o
14.594 [6128/17/411] Building IntrinsicsWebAssembly.h...
14.594 [6128/16/412] Building IntrinsicsAMDGPU.h...
14.607 [6128/15/413] Building IntrinsicsXCore.h...
14.636 [6128/14/414] Building CXX object unittests/DebugInfo/MSF/CMakeFiles/DebugInfoMSFTests.dir/MSFBuilderTest.cpp.o
14.729 [6128/13/415] Building ARMTargetParserDef.inc...
15.066 [6128/12/416] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o
15.146 [6128/11/417] Building CXX object unittests/DebugInfo/MSF/CMakeFiles/DebugInfoMSFTests.dir/MappedBlockStreamTest.cpp.o
15.270 [6128/10/418] Building CXX object tools/clang/utils/TableGen/CMakeFiles/clang-tblgen.dir/RISCVVEmitter.cpp.o
15.480 [6128/9/419] Building CXX object unittests/DebugInfo/CodeView/CMakeFiles/DebugInfoCodeViewTests.dir/TypeIndexDiscoveryTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 30, 2025

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-multistage running on systemz-1 while building cmake,llvm,mlir at step 4 "build stage 1".

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

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja -j4' (failure)
...
[201/6069] Building CXX object lib/Option/CMakeFiles/LLVMOption.dir/OptTable.cpp.o
[202/6069] Linking CXX static library lib/libLLVMOption.a
[203/6069] Building CXX object lib/Extensions/CMakeFiles/LLVMExtensions.dir/Extensions.cpp.o
[204/6069] Linking CXX static library lib/libLLVMExtensions.a
[205/6069] Building CXX object utils/TableGen/Basic/CMakeFiles/obj.LLVMTableGenBasic.dir/IntrinsicEmitter.cpp.o
[206/6069] Linking CXX executable bin/llvm-min-tblgen
[207/6069] Building CXX object lib/DebugInfo/MSF/CMakeFiles/LLVMDebugInfoMSF.dir/MSFBuilder.cpp.o
[208/6069] Building CXX object lib/DebugInfo/MSF/CMakeFiles/LLVMDebugInfoMSF.dir/MappedBlockStream.cpp.o
[209/6069] Linking CXX static library lib/libLLVMTableGenBasic.a
[210/6069] Building GenVT.inc...
FAILED: include/llvm/CodeGen/GenVT.inc /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/include/llvm/CodeGen/GenVT.inc 
cd /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/include/llvm/CodeGen && /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-min-tblgen -gen-vt -I /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/include/llvm/CodeGen -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/include -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/include /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/include/llvm/CodeGen/ValueTypes.td --write-if-changed -o GenVT.inc -d GenVT.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/include/llvm/CodeGen /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1 /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/include/llvm/CodeGen /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/include/llvm/CodeGen/GenVT.inc.d /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/CMakeFiles/d/9dd42a048f70895073c42a92e2fcbe94da22b57a14dfe8d83b235a85c6854461.d
[211/6069] Building IntrinsicsNVPTX.h...
[212/6069] Building IntrinsicsR600.h...
[213/6069] Building CXX object lib/FileCheck/CMakeFiles/LLVMFileCheck.dir/FileCheck.cpp.o
ninja: build stopped: subcommand failed.

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something
breaks.

Partially fixes llvm#83727.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This reverts commit ab405fb.

This caused quite a few buildbot failures that need further
investigation.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something
breaks.

Partially fixes llvm#83727.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This reverts commit ab405fb.

This caused quite a few buildbot failures that need further
investigation.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something
breaks.

Partially fixes llvm#83727.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This reverts commit ab405fb.

This caused quite a few buildbot failures that need further
investigation.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something
breaks.

Partially fixes llvm#83727.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
This reverts commit ab405fb.

This caused quite a few buildbot failures that need further
investigation.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request May 15, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request May 29, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
SquallATF pushed a commit to SquallATF/llvm-project that referenced this pull request Jun 13, 2025
This reverts commit fa65a22.

This relands commit ab405fb.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
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 mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmake 3.28 deprecation warnings
8 participants