The conditions to check LLVM version, e.g. .if ${COMPILER_VERSION} > ${LLVM_DEFAULT} and . if ${COMPILER_VERSION} <= 11 are not correct, because llvm version is not monotonic (60, 70, 80, 90, 10, 11) Imo we should rename e.g. llvm10 to llvm100 to fix this properly and not overcomplicate logic here and in other places.
@brooks, what do you think? It would be very handy if version numbers for llvm where in fact matching what compiler.mk sets for clang.
Created attachment 221794 [details] Fix version detection and dependency I stumbled on this as well. Please see the attached patch. I'm not completely sure of what was exactly intended in the original code. The test on ${COMPILER_VERSION}, in particular, led me to think that using the base compiler had been considered as a possibility. However, without further patching of the configure part, this cannot work since there is no `llvm-config` in base (and LLVM in base may lack required components anyway, I don't know). Apart from that, changes are pretty straightforward. They deal with non-monotonic versions. The algorithm is simply to try to use LLVM_DEFAULT, provided it is not greater than MAX_ALLOWED_MAJOR (set to 11, as before), in which case that one is used instead. I agree that part of it (e.g., determination of major LLVM version) should ideally go into some infrastructure *.mk file.