[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `clang-ppc64-aix` running on `aix-ppc64` while building `bolt,clang,flang,lld,lldb,mlir,polly` at step 6 "test-build-unified-tree-check-all". Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3735 Here is the relevant piece of the build log for the reference ``` Step 6 (test-build-unified-tree-check-all) failure: test (failure) TEST 'lit :: timeout-hang.py' FAILED Exit Code: 1 Command Output (stdout): -- # RUN: at line 13 not env -u FILECHECK_OPTS "/home/llvm/llvm-external-buildbots/workers/env/bin/python3.11" /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt --timeout=1 --param external=0 | "/home/llvm/llvm-external-buildbots/workers/env/bin/python3.11" /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/utils/lit/tests/timeout-hang.py 1 # executed command: not env -u FILECHECK_OPTS /home/llvm/llvm-external-buildbots/workers/env/bin/python3.11 /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt --timeout=1 --param external=0 # .---command stderr # | lit.py: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1 seconds was requested on the command line. Forcing timeout to be 1 seconds. # `- # executed command: /home/llvm/llvm-external-buildbots/workers/env/bin/python3.11 /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/utils/lit/tests/timeout-hang.py 1 # .---command stdout # | Testing took as long or longer than timeout # `- # error: command failed with exit status: 1 -- ``` https://github.com/llvm/llvm-project/pull/138587 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-gcc-ubuntu-no-asserts` running on `doug-worker-6` while building `bolt,clang,flang,lld,lldb,mlir,polly` at step 6 "test-build-unified-tree-check-all". Full details are available at: https://lab.llvm.org/buildbot/#/builders/202/builds/1378 Here is the relevant piece of the build log for the reference ``` Step 6 (test-build-unified-tree-check-all) failure: test (failure) ... PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-rewritten-binop.cpp (22841 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-multidimensional.cpp (22842 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert.c (22843 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-structured-binding.cpp (22844 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-negative.cpp (22845 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/macro-to-enum.c (22846 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-uppercase.cpp (22847 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-basic.cpp (22848 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-unique-cxx11.cpp (22849 of 88321) TIMEOUT: AddressSanitizer-x86_64-linux-dynamic :: TestCases/asan_lsan_deadlock.cpp (22850 of 88321) TEST 'AddressSanitizer-x86_64-linux-dynamic :: TestCases/asan_lsan_deadlock.cpp' FAILED Exit Code: -9 Timeout: Reached timeout of 900 seconds Command Output (stderr): -- /home/buildbot/buildbot-root/gcc-no-asserts/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -shared-libasan -O0 /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -o /home/buildbot/buildbot-root/gcc-no-asserts/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp # RUN: at line 4 + /home/buildbot/buildbot-root/gcc-no-asserts/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -shared-libasan -O0 /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -o /home/buildbot/buildbot-root/gcc-no-asserts/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp env ASAN_OPTIONS=detect_leaks=1 not /home/buildbot/buildbot-root/gcc-no-asserts/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp 2>&1 | FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp # RUN: at line 5 + env ASAN_OPTIONS=detect_leaks=1 not /home/buildbot/buildbot-root/gcc-no-asserts/build/runtimes/runtimes-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp + FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -- PASS: Clang Tools :: clang-tidy/checkers/modernize/make-shared-header.cpp (22851 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-extra.cpp (22852 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/macro-to-enum.cpp (22853 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-unique-default-init.cpp (22854 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-unique-inaccessible-ctors.cpp (22855 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-unique-macros.cpp (22856 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-unique-header.cpp (22857 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/pass-by-value-header.cpp (22858 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/pass-by-value-multi-fixes.cpp (22859 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-shared.cpp (22860 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/loop-convert-reverse.cpp (22861 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/pass-by-value-macro-header.cpp (22862 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/raw-string-literal-delimiter.cpp (22863 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/redundant-void-arg.c (22864 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/raw-string-literal-replace-shorter.cpp (22865 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/pass-by-value.cpp (22866 of 88321) PASS: Clang Tools :: clang-tidy/checkers/modernize/make-unique.cpp (22867 of 88321) PASS: Cla
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
https://github.com/petrhosek approved this pull request. https://github.com/llvm/llvm-project/pull/138587 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
https://github.com/mstorsjo approved this pull request. LGTM IIRC @petrhosek had commented on this before, and was generally in favour of it, but I'd still leave it open for a couple days if he wants to comment further on it. https://github.com/llvm/llvm-project/pull/138587 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
jeremyd2019 wrote: > > I rebased this on top of #138783 and adjusted the title and description. > > Now it should be in a good state to push cmake changes for other projects. > > The changes look good, but it looks like the changes from #138783 still show > up when viewing the changes; can you check that you've rebased past the > merged #138783? I had not - I have now though. > (Also, I take it that no other subprojects than clang need the > `cmake_push_check_state` change?) No, the other projects were not messing with `_GNU_SOURCE` like clang was. https://github.com/llvm/llvm-project/pull/138587 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
https://github.com/jeremyd2019 updated
https://github.com/llvm/llvm-project/pull/138587
>From 052580cd9ee141cd8c79e9588ad1c71e31f58cb3 Mon Sep 17 00:00:00 2001
From: Jeremy Drake
Date: Mon, 5 May 2025 14:11:44 -0700
Subject: [PATCH 1/7] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS
In #138329, _GNU_SOURCE was added for Cygwin, but when building Clang
standalone against an installed LLVM this definition was not picked up,
resulting in undefined strnlen. Follow the documentation in
https://llvm.org/docs/CMake.html#developing-llvm-passes-out-of-source
and add the LLVM_DEFINITIONS in standalone projects' cmakes.
---
clang/CMakeLists.txt | 4
1 file changed, 4 insertions(+)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f12712f55fb96..ab2ac9bc6b9ad 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -68,6 +68,10 @@ if(CLANG_BUILT_STANDALONE)
option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+ add_definitions(${LLVM_DEFINITIONS_LIST})
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
+
include(AddLLVM)
include(TableGen)
include(HandleLLVMOptions)
>From a59bbb92c54d81d06754d49190d7a46ba269b1ef Mon Sep 17 00:00:00 2001
From: Jeremy Drake
Date: Wed, 7 May 2025 11:24:55 -0700
Subject: [PATCH 2/7] fixup! [CMake] respect LLVMConfig.cmake's
LLVM_DEFINITIONS
bolt
---
bolt/CMakeLists.txt | 4
1 file changed, 4 insertions(+)
diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index 52c796518ac05..5c7d51e1e398c 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -46,6 +46,10 @@ if(BOLT_BUILT_STANDALONE)
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+ add_definitions(${LLVM_DEFINITIONS_LIST})
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
+
include(AddLLVM)
include(TableGen)
include_directories(${LLVM_INCLUDE_DIRS})
>From 595f483ff1403f282217ff4999f7640465b5dada Mon Sep 17 00:00:00 2001
From: Jeremy Drake
Date: Wed, 7 May 2025 11:27:53 -0700
Subject: [PATCH 3/7] fixup! [CMake] respect LLVMConfig.cmake's
LLVM_DEFINITIONS
flang
---
flang/CMakeLists.txt | 5 +
1 file changed, 5 insertions(+)
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index f358a93fdd792..56a96f590f0a3 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -140,6 +140,11 @@ if (FLANG_STANDALONE_BUILD)
if (NOT DEFINED LLVM_MAIN_SRC_DIR)
set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm")
endif()
+
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+ add_definitions(${LLVM_DEFINITIONS_LIST})
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
+
include(AddLLVM)
include(HandleLLVMOptions)
include(VersionFromVCS)
>From 8eeb00ff57a90ae7e4a775f7fa85a4d3529f143d Mon Sep 17 00:00:00 2001
From: Jeremy Drake
Date: Wed, 7 May 2025 11:28:22 -0700
Subject: [PATCH 4/7] fixup! [CMake] respect LLVMConfig.cmake's
LLVM_DEFINITIONS
lld
---
lld/CMakeLists.txt | 4
1 file changed, 4 insertions(+)
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 9b202cc5d4899..80e25204a65ee 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -39,6 +39,10 @@ if(LLD_BUILT_STANDALONE)
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+ add_definitions(${LLVM_DEFINITIONS_LIST})
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
+
include(AddLLVM)
include(TableGen)
include(HandleLLVMOptions)
>From e2510293883ff6499890de1a4a5de4c1d53beac3 Mon Sep 17 00:00:00 2001
From: Jeremy Drake
Date: Wed, 7 May 2025 11:31:01 -0700
Subject: [PATCH 5/7] fixup! [CMake] respect LLVMConfig.cmake's
LLVM_DEFINITIONS
lldb
---
lldb/cmake/modules/LLDBStandalone.cmake | 4
1 file changed, 4 insertions(+)
diff --git a/lldb/cmake/modules/LLDBStandalone.cmake
b/lldb/cmake/modules/LLDBStandalone.cmake
index c9367214848fd..1a4cdbfbb1cc7 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -85,6 +85,10 @@ endif()
# CMake modules to be in that directory as well.
list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
+separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
+add_definitions(${LLVM_DEFINITIONS_LIST})
+list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
+
include(AddLLVM)
include(TableGen)
include(HandleLLVMOptions)
>From f9f30f2871fd3f5eedcf90b6f41c8e17b9d
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
mstorsjo wrote: > I rebased this on top of #138783 and adjusted the title and description. Now > it should be in a good state to push cmake changes for other projects. The changes look good, but it looks like the changes from #138783 still show up when viewing the changes; can you check that you've rebased past the merged #138783? (Also, I take it that no other subprojects than clang need the `cmake_push_check_state` change?) https://github.com/llvm/llvm-project/pull/138587 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [lldb] [llvm] [mlir] [polly] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS in standalone builds (PR #138587)
https://github.com/jeremyd2019 edited https://github.com/llvm/llvm-project/pull/138587 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
