Skip to content

[lld,CMake] Include Version.inc when LLVM_DISTRIBUTION_COMPONENTS contains lld-headers #127946

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

Conversation

makslevental
Copy link
Contributor

@makslevental makslevental commented Feb 20, 2025

Without this inc file getLLDVersion cannot be called; see https://github.com/llvm/llvm-project/blob/main/lld/include/lld/Common/Version.h#L16.

Fixes incomplete solution introduced by #127123.

@makslevental makslevental requested a review from MaskRay February 20, 2025 02:48
@llvmbot llvmbot added the lld label Feb 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 20, 2025

@llvm/pr-subscribers-lld

Author: Maksim Levental (makslevental)

Changes

Without this inc file getLLDVersion is not possible; see https://github.com/llvm/llvm-project/blob/main/lld/include/lld/Common/Version.h#L16.


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

1 Files Affected:

  • (modified) lld/CMakeLists.txt (+1)
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 012a943d5bcec..55d7599a447fc 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -207,6 +207,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     COMPONENT lld-headers
     FILES_MATCHING
     PATTERN "*.h"
+    PATTERN "*.inc"
     )
 
   if (NOT LLVM_ENABLE_IDE)

@MaskRay
Copy link
Member

MaskRay commented Feb 20, 2025

I actually noticed that your previous lld patch did not include .inc. I thought that it was ok because that I don't find a .inc in the source tree (except include/lld/Common/BPSectionOrdererBase.inc, which does not define APIs).

I'd love to see more testing in the future to minimize the need for these kinds of fixes. Please update the description to say that this fixes #127123

@MaskRay MaskRay changed the title [lld][build] include Version.inc [lld,CMake] Include Version.inc when LLVM_DISTRIBUTION_COMPONENTS contains lld-headers Feb 20, 2025
@makslevental
Copy link
Contributor Author

makslevental commented Feb 20, 2025

I'd love to see more testing in the future to minimize the need for these kinds of fixes.

I'm all for testing and more testing but I'm not sure how this particular issue could be tested since this is a build/install system change. In MLIR we have out-of-tree examples that are actually built in CI to in order exactly to exercise such patches. But lld doesn't right? (Unless I missed it).

@makslevental
Copy link
Contributor Author

@MaskRay anything else left here?

@MaskRay
Copy link
Member

MaskRay commented Feb 21, 2025

I'd love to see more testing in the future to minimize the need for these kinds of fixes.

I'm all for testing and more testing but I'm not sure how this particular issue could be tested since this is a build/install system change. In MLIR we have out-of-tree examples that are actually built in CI to in order exactly to exercise such patches. But lld doesn't right? (Unless I missed it).

Couldn't you run the pipeline locally and figure out the missing file issue earlier? Why do you need to trial and error for the llvm-project part?

@makslevental
Copy link
Contributor Author

makslevental commented Feb 21, 2025

Couldn't you run the pipeline locally and figure out the missing file issue earlier?

The build system in Triton is complex - requiring separately staged PRs to separate branches (llvm-head, main is the one you found). So testing both our version bump and the feature isn't possible. In addition the downstream requirements were being adjusted - I had of course tested locally with downstream for successful linking but missed the requirement for the version.

Why do you need to trial and error for the llvm-project part?

It isn't a need - it was a simple mistake influenced by the above circumstances.

@MaskRay MaskRay merged commit a66376b into llvm:main Feb 21, 2025
10 checks passed
@makslevental makslevental deleted the makslevental/lld-include-version.inc branch February 21, 2025 17:06
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 21, 2025

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building lld at step 7 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
...
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Integer/incdec-overflow.cpp (94445 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Integer/suppressions.cpp (94446 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Misc/Posix/ubsan_options.cpp (94447 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Misc/Posix/sigaction.cpp (94448 of 98488)
PASS: UBSan-MemorySanitizer-x86_64 :: TestCases/Misc/local_bounds.cpp (94449 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Misc/bool.cpp (94450 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Misc/Posix/static-link.cpp (94451 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Integer/unsigned-shift.cpp (94452 of 98488)
PASS: UBSan-Standalone-lld-x86_64 :: TestCases/Misc/bool.m (94453 of 98488)
TIMEOUT: MLIR :: Examples/standalone/test.toy (94454 of 98488)
******************** TEST 'MLIR :: Examples/standalone/test.toy' FAILED ********************
Exit Code: 1
Timeout: Reached timeout of 60 seconds

Command Output (stdout):
--
# RUN: at line 1
"/etc/cmake/bin/cmake" "/build/buildbot/premerge-monolithic-linux/llvm-project/mlir/examples/standalone" -G "Ninja"  -DCMAKE_CXX_COMPILER=/usr/bin/clang++  -DCMAKE_C_COMPILER=/usr/bin/clang   -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir  -DLLVM_USE_LINKER=lld  -DPython3_EXECUTABLE="/usr/bin/python3.10"
# executed command: /etc/cmake/bin/cmake /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/examples/standalone -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir -DLLVM_USE_LINKER=lld -DPython3_EXECUTABLE=/usr/bin/python3.10
# .---command stdout------------
# | -- The CXX compiler identification is Clang 16.0.6
# | -- The C compiler identification is Clang 16.0.6
# | -- Detecting CXX compiler ABI info
# | -- Detecting CXX compiler ABI info - done
# | -- Check for working CXX compiler: /usr/bin/clang++ - skipped
# | -- Detecting CXX compile features
# | -- Detecting CXX compile features - done
# | -- Detecting C compiler ABI info
# | -- Detecting C compiler ABI info - done
# | -- Check for working C compiler: /usr/bin/clang - skipped
# | -- Detecting C compile features
# | -- Detecting C compile features - done
# | -- Looking for histedit.h
# | -- Looking for histedit.h - found
# | -- Found LibEdit: /usr/include (found version "2.11") 
# | -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
# | -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
# | -- Using MLIRConfig.cmake in: /build/buildbot/premerge-monolithic-linux/build/lib/cmake/mlir
# | -- Using LLVMConfig.cmake in: /build/buildbot/premerge-monolithic-linux/build/lib/cmake/llvm
# | -- Linker detection: unknown
# | -- Performing Test LLVM_LIBSTDCXX_MIN
# | -- Performing Test LLVM_LIBSTDCXX_MIN - Success
# | -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR
# | -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success
# | -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER
# | -- Performing Test CXX_SUPPORTS_CUSTOM_LINKER - Success
# | -- Performing Test C_SUPPORTS_FPIC
# | -- Performing Test C_SUPPORTS_FPIC - Success
# | -- Performing Test CXX_SUPPORTS_FPIC

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 22, 2025

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

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

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/38/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-22048-38-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 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




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


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants