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

Conversation

arichardson
Copy link
Member

If DESTDIR is set in the environment during the build/test stage, the
local libc++ installation will be installed under DESTDIR instead of being
in the build directory.

See #115077 (comment)
and https://gitlab.kitware.com/cmake/cmake/-/issues/18165.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@arichardson arichardson requested a review from bjope November 8, 2024 18:06
@arichardson arichardson merged commit a29e623 into main Nov 8, 2024
5 of 6 checks passed
@arichardson arichardson deleted the users/arichardson/spr/compiler-rt-make-add_custom_libcxx-resilient-to-destdir-being-set branch November 8, 2024 19:45
@@ -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

Groverkss pushed a commit to iree-org/llvm-project that referenced this pull request Nov 15, 2024
If DESTDIR is set in the environment during the build/test stage, the
local libc++ installation will be installed under DESTDIR instead of being
in the build directory.

See llvm#115077 (comment)
and https://gitlab.kitware.com/cmake/cmake/-/issues/18165.

Pull Request: llvm#115525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants