-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libclc] use default paths with find_program when possible #105969
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
base: main
Are you sure you want to change the base?
Conversation
e8b9102
to
056e0f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nix build should probably migrate to using the non-standalone build
@@ -55,7 +55,7 @@ if( LIBCLC_STANDALONE_BUILD OR CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DI | |||
# Import required tools | |||
if( NOT EXISTS ${LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR} ) | |||
foreach( tool IN ITEMS clang llvm-as llvm-link opt ) | |||
find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH ) | |||
find_program( LLVM_TOOL_${tool} ${tool} PATHS ${LLVM_TOOLS_BINARY_DIR} ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to find any binary? Can't it just use the imported targets from the find_package(LLVM) above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At https://github.com/RossComputerGuy/llvm-project/blob/056e0f9b7c7b788ad0d85a1479000fd1af4f98ce/libclc/CMakeLists.txt#L100-L104 there is a check for missing tools. This check would not work if using the imported targets if LLVM CMake files are installed, but the binaries are missing, which because of the way LLVM is split in distros is something that can easily happen.
Apologies, but I'm having a bit of trouble understanding the scenario that this PR addresses. It looks like it's meant to handle the case where |
Nixpkgs has no intention of moving away from standalone builds. |
Nixpkgs adds the tools being used to |
I encourage you to acquire that intention. IMO libclc should not support the standalone build, and this should be version locked to the exact compiler commit. It's compiler data, not a real library |
This PR enables inadvertent errors on non-Nix systems though. When a specific LLVM path is used, and a binary is missing there, but a different binary with the same name is available in If standalone builds continue to be used, could this be avoided by changing the Nixpkgs build to install symlinks to all needed tools in a single directory (possibly a temporary directory populated during the libclc build), and making that directory available as |
So it should be built along with the core of LLVM? Also, we package LLVM per version per subproject.
Maybe, although that sounds a bit hacky. |
Yes, it should be built along with the core (but doesn't need to ship in the same package as the core). |
Sounds good, I'll communicate with the other LLVM Nix maintainers and see if this is a good idea to fully go ahead on. |
I don't disagree. The standalone builds are never going to be well tested and imo are a considerable barrier to (confidently) improving libclc. I know we've discussed this in the past. That said, I'm not sure what the best course of action is. Would we be best to deprecate standalone builds in the next release, then drop them afterwards? Do we need an RFC? Do we need documentation for users on how to find the "archived" standalone build support if they wanted it? |
Patch pulled from NixOS/nixpkgs#336465
This PR removes
NO_DEFAULT_PATH
where possible, the flag prevents Nix from building libclc correctly.