Skip to content

[compiler-rt] Make add_custom_libcxx() resilient to DESTDIR being set #115525

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler-rt/cmake/Modules/AddCompilerRT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ macro(add_custom_libcxx name prefix)
USES_TERMINAL_INSTALL 1
LIST_SEPARATOR |
EXCLUDE_FROM_ALL TRUE
# Ensure that DESTDIR=... set in the out environment does not affect this
# target (we always need to install to the build directory).
INSTALL_COMMAND env DESTDIR= ${CMAKE_COMMAND} --build ${prefix}/build --target install
INSTALL_BYPRODUCTS "${prefix}/lib/libc++.a" "${prefix}/lib/libc++abi.a"
Copy link
Collaborator

@bjope bjope Nov 10, 2024

Choose a reason for hiding this comment

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

With the INSTALL_COMMAND fix we now get this:

[2091/2122] Performing install step for 'libcxx_fuzzer_x86_64'
ninja: error: unknown target 'INSTALL_BYPRODUCTS'
FAILED: compiler-rt/lib/fuzzer/libcxx_fuzzer_x86_64/src/libcxx_fuzzer_x86_64-stamp/libcxx_fuzzer_x86_64-install 
cd /repo/llvm/build-all/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_x86_64/build && env DESTDIR= /cmake/3.20.1/bin/cmake --build /repo/llvm/build-all/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_x86_64/build --target install INSTALL_BYPRODUCTS /repo/llvm/build-all/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_x86_64/lib/libc++.a /repo/llvm/build-all/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_x86_64/lib/libc++abi.a && /cmake/3.20.1/bin/cmake -E touch /repo/llvm/build-all/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/fuzzer/libcxx_fuzzer_x86_64/src/libcxx_fuzzer_x86_64-stamp/libcxx_fuzzer_x86_64-install
ninja: build stopped: subcommand failed.
FAILED: runtimes/runtimes-x86_64-unknown-linux-gnu-stamps/runtimes-x86_64-unknown-linux-gnu-build 
cd /repo/llvm/build-all/runtimes/runtimes-x86_64-unknown-linux-gnu-bins && /cmake/3.20.1/bin/cmake --build .
ninja: build stopped: subcommand failed.

Copy link
Collaborator

@bjope bjope Nov 10, 2024

Choose a reason for hiding this comment

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

Ah, maybe the earlier patch that added INSTALL_BYPRODUCTS need to bump the requirement on cmake version to 3.26 (while current requirement is 3.20.0 according to https://llvm.org/docs/GettingStarted.html#software).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I guess I had a newer CMake, we can make this conditional on CMake version.

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 just built with CMake 3.20 and am able to reproduce - will fix now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed by #115677

)

Expand Down
Loading