feat: add clang support to llvm-core Conan recipe#513
Conversation
Add with_clang option to llvm-core recipe that builds clang alongside LLVM from the same source. This ensures exact version match between clang and LLVM for bitcode compatibility in the pre-built JIT IR framework. Changes: - scripts/conan/patches/llvm-core-add-clang-support.patch: adds with_clang option, clang source download, LLVM_ENABLE_PROJECTS, and clang library exclusion from components - conanfile.py: enables with_clang=True when JIT is enabled Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| + if self.options.with_clang: | ||
| + bindir = os.path.join(self.package_folder, "bin") | ||
| + self.buildenv_info.prepend_path("PATH", bindir) |
There was a problem hiding this comment.
From the conan documentation at https://docs.conan.io/2/reference/conanfile/methods/package_info.html
It is not necessary to add bindirs to the PATH environment variable, this will be automatically done by the consumer VirtualBuildEnv and VirtualRunEnv generators. Likewise, it is not necessary to add includedirs, libdirs or any other dirs to environment variables, as this information will be typically managed by other generators.
It looks like this is not necessary?
There was a problem hiding this comment.
Actually, I am mistaken as bindir here is just the variable. But maybe LLVM should export it's bindir to the conan package so that the binaries are propagated?
On the same page, the example is
self.cpp_info.bindirs = ['bin'] # Directories where executables and shared libs can be found
Conan's default cpp_info.bindirs=['bin'] already propagates the bin directory to consumers via VirtualBuildEnv. No need to manually prepend PATH. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@zhangxffff Have you tested that the new recipe works for PR #501 ? Also, I think something is not correct with the patch, because I would expect that adding this patch would cause the CI to rebuild the llvm-core recipe, but it seems like it's not rebuilding it. Can you look into that? |
For the question before, we use The reason |
OK, it seems that modify patch does not retigger CI, I will look at it. |
Add --index=0 to local-recipes-index remotes so patched recipes take precedence over pre-built packages on CI remotes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This reverts commit 4ed463b.
Add a script that detects which Conan recipes are changed in the current PR (from CCI patches or bolt-local recipes), copies only those into an override remote at index 0. This ensures modified recipes rebuild from source while everything else reuses cached binaries from the CI remote. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tilde does not expand inside ${VAR:-~/.conan2}, causing [ -d ] and
cp -r to receive a literal ~ path and fail silently.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fail early if clang binary is missing from the llvm-core package when JIT is enabled. Version check is handled in CMakeLists.txt. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@ZacBlanco The reason we cannot trigger a rebuild for I tried adding So what we do now is add a step in the GitHub Action to extract modified recipes from the changed code and move them into a separate local Conan server Result for a PR that modifies llvm-core: Action output shows that llvm-core was successfully rebuilt. |
ZacBlanco
left a comment
There was a problem hiding this comment.
The recipe changes themselves LGTM, but I think the patch should just update the llvm-core recipe version as well so we don't conflict with the OSS conan recipe version.
There was a problem hiding this comment.
I think this script is too complex to be worth committing and maintaining. I would rather have the patch update the LLVM-core recipe version to 19.1.7-bolt instead, and then just have bolt's conanfile reference 19.1.7-bolt. No external conan remote will have that version, so it will be forced to get picked from the CCI local recipe index.
There was a problem hiding this comment.
I agree with updating the version for the llvm-core recipe. However, without this script, changes to scripts/conan/patches or scripts/conan/recipes would not trigger a rebuild in CI unless the version is also updated. Since we always upload used conan recipes to the ci server, and it is always searched first, this overrides the CCI local recipe index and prevents us from picking up recipes from CCI local even we have a version that differs from official conan server.
bolt/.github/workflows/conan-upload.yml
Lines 75 to 81 in 17a2d9b
If we remove this script, we would need to establish a convention that any modification to a recipe must be accompanied by a corresponding version update to ensure CI rebuilds the changed recipe.
There was a problem hiding this comment.
I think having a convention where we update the recipe version is not a bad, but is somewhat tedious. I guess I am ok with this script for now then. If it presents issues in the future, we might want to look at other solutions.
Anyways, we can merge this then. Can you test on your other PR to make sure that this recipe works before merging though?
Rename the patched CCI recipe to 19.1.7-bolt so the version itself disambiguates from upstream conan-center-index, removing the need for a separate CI script that detects and overrides modified recipes. Recipe/patch changes now require a corresponding version bump to trigger a rebuild. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@zhangxffff once you can confirm the recipe works for #501 we can merge this, upload the new recipe to CI conan server, and then you can rebase 501 |
Add with_clang option to llvm-core recipe that builds clang alongside LLVM from the same source. This ensures exact version match between clang and LLVM for bitcode compatibility in the pre-built JIT IR framework.
Changes:
What problem does this PR solve?
Issue Number: related #502
Type of Change
Description
Describe your changes in detail.
For complex logic, explain the "Why" and "How".
Performance Impact
No Impact: This change does not affect the critical path (e.g., build system, doc, error handling).
Positive Impact: I have run benchmarks.
Click to view Benchmark Results
Negative Impact: Explained below (e.g., trade-off for correctness).
Release Note
Please describe the changes in this PR
Release Note:
Checklist (For Author)
Breaking Changes
No
Yes (Description: ...)
Click to view Breaking Changes