Skip to content

[llvm-config] Append the version number to the llvm-config executable name #150774

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

Open
wants to merge 1 commit into
base: release/20.x
Choose a base branch
from

Conversation

illwieckz
Copy link
Contributor

  • Append the version number to the llvm-config executable name.

So llvm-config is installed as llvm-config-20 and llvm-config is a symlink to it, the same way clang is installed as clang-20 and clang is a symlink to it.

I target the LLVM 20 branch because this is the one I currently use in my development and after having rebased to the current main it failed to build and I couldn't test it. By targeting the LLVM 20 branch I made sure I could test it and I tested it and I confirm it works.

I expect this to be merged in any maintained LLVM version branch.

The motivation for this is that when building Mesa, the Mesa build system selected my system's clang 20 because there was a llvm-config-20 in path that had an higher version number than the llvm-config executable I built myself for the sole purpose of being used by my Mesa build. But the system LLVM had a different minor version than the one I built and because Mesa linked against the system LLVM but ran against my self-built LLVM, it faced symbol mismatches and crashed.

It is then required by users to have their self-built LLVM to append the version number to the llvm-config binary. In fact the distribution packages already do that, and the system LLVM that mismatched my Mesa build comes from the official apt.llvm.org that is already doing that.

So by merging this patch we also make possible to simplify all the distro-specific packaging scripts by making possible to remove all the custom code to create after installation a symlink with an appended version number.

This code is the same code used by for appending the version number to the clang binary, copy-pasted and adapted to the llvm-config binary.

There is one known drawback, it's that once the version number is set in CMake configuration by CMake the first time CMake runs, that version will not change when pulling the repository and the LLVM version has been bumped (LLVM_CONFIG_EXECUTABLE_VERSION is set once for all). This limitation is not specific to this branch and is already true for the clang binary and the libclang library (CLANG_EXECUTABLE_VERSION and LIBCLANG_LIBRARY_VERSION are set once for all). Fixing that much general problem is not within the scope of that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant