prevent the LLVM libraries bundled with clang binary from being discovered in pinned builds #834
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a failure of the pinned builds on ubuntu 22.04 that was bubbled up due to changes in #799
cmake has a well defined order in which it searches for packages when doing a
find_package()
. Critically,CMAKE_PREFIX_PATH
locations are searched before searching something likePATH
. This meant, previously, when searching for LLVM without a specific version we'd find the LLVM we built in the specifiedCMAKE_PREFIX_PATH
early on during the search (except.. for see below). However the new version searching logic has the side effect of searching only for, say, LLVM 11.0 before it falls back to searching for LLVM 7.0. This means it ends up finding the incompatible LLVM 11.0 shipped in the clang binary viaPATH
and uses that instead.Just remove the LLVM cmake files shipped with the compiler binary so cmake doesn't end up finding them. This compiler is intended for pinned leap builds only, so "damaging" it seems okay.
But wait! There's more!
The script was originally doing
-DCMAKE_PREFIX_PATH=${LLVM_DIR}/lib/cmake -DCMAKE_PREFIX_PATH=${BOOST_DIR}/bin
but these do not compound in to a list: the second parameter overwrites the first. This meant${LLVM_DIR}/lib/cmake
was actually not in theCMAKE_PREFIX_PATH
search path! So how did this work before? 🤷♀️ 🤷 🤷♂️ I didn't dig more on that.