-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
[libclc] Fix a couple of issues preventing in-tree builds #87505
Conversation
libclc is mentioned in the list of LLVM_ENABLE_PROJECTS but it isn't actually possible to build it in-tree for various reasons. Users currently have to build it via LLVM_ENABLE_EXTERNAL_PROJECTS, which isn't very well documented. We can't properly build in-tree because the current system needs to "see" clang and other tools at CMake configuration time. The general idea is that we could fix this in the future by moving the compilation and linking of bitcode libraries to custom commands, which would remove the dependency on CMake configuration and would allow us to build libclc after clang and other tools are built in-tree. Since that's a bigger change, it is being left for later. Note that with this commit it's *still* not possible to properly build in-tree - this commit just fixes a few little things that are in the way. We are now able to build in-tree in the sense that it can be built as a regular LLVM sub-project, but the tools it uses to compile the libraries are still picked up from a pre-existing installation of LLVM, and not from tools built during the same build as libclc. The things fixed by this commit include: * Its use of CMAKE_SOURCE_DIR (i.e., assuming it was the top-level project) * These have been converted to PROJECT_SOURCE_DIR - should have no consequences for out-of-tree builds. * Its prepare_builtins tool insisting on linking against the dynamic LLVM.so. * This has been turned from an "llvm executable" into an "llvm utility" which links against the static libraries. * It was also missing a link component for the IRReader library. * Assuming an output path for its builtin libraries (dependent on the working directory) * This has been changed to query CMake for the library target's output file. * The spirv-mesa3d and spirv64-mesa3d targets were enabled by default (or when asking to build 'all' libclc targets), when they require llvm-spirv as an external dependency. * They are now only built when the user explicitly asks for them, or when llvm-spirv is available and the user asks for 'all'.
CC @rjodinchr - I can't seem to request a review from you. I wasn't sure whether or not to change I still don't really get if we're building |
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.
I have been trying to build libclc as an external project here, but I cannot manage to figure out the issue I have on windows.
Looking forward to being able to build libclc in-tree!
This change broke standalone build against LLVM dylib — it now insists on linking to non-existing static libraries:
Given that it apparently doesn't fix in-tree builds fully, please revert and let's figure out how to do it properly without breaking its primary use case. |
Ach, sorry about that, thanks for catching that. It's tricky without CI to catch this kind of thing, though that was particularly silly of me. I actually struggled to build LLVM locally with the kind of configuration that only has dynamic libraries available to reproduce. That said, I've pushed 8461d90 which should just re-instate the old behaviour for out-of-tree builds. If that doesn't fix the issue then I'll revert properly - please let me know, thanks. |
Thanks. This seems to fix that problem. However, now I'm seeing missing dep in build ordering:
Note that |
I think that ought to be |
Hmm yes you might be right. Just to confirm, does that fix the problem for you? I can't be sure but it seems like that was a problem before 61efea7 when I last touched it, as least from a simple reading of the CMake. |
I think the issue is not coming from the DEPENDS but from the source.
|
Yes, that's it. |
Should be fixed by f46f646 |
Thanks. Unfortunately, I'm still getting a build failure:
It seems to be missing |
Sorry, it should be properly fixed now - I was rushing things and that just made it worse. I hadn't noticed that the build I was testing hadn't found |
Yeah, it built this time for me too. Thanks, again! |
libclc is mentioned in the list of LLVM_ENABLE_PROJECTS but it isn't actually possible to build it in-tree for various reasons. Users currently have to build it via LLVM_ENABLE_EXTERNAL_PROJECTS, which isn't very well documented.
We can't properly build in-tree because the current system needs to "see" clang and other tools at CMake configuration time. The general idea is that we could fix this in the future by moving the compilation and linking of bitcode libraries to custom commands, which would remove the dependency on CMake configuration and would allow us to build libclc after clang and other tools are built in-tree. Since that's a bigger change, it is being left for later.
Note that with this commit it's still not possible to properly build in-tree - this commit just fixes a few little things that are in the way. We are now able to build in-tree in the sense that it can be built as a regular LLVM sub-project, but the tools it uses to compile the libraries are still picked up from a pre-existing installation of LLVM, and not from tools built during the same build as libclc.
The things fixed by this commit include: