Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Fix put preferable llvm-config-14 first.

Open shizeeg opened this issue 2 years ago • 1 comments

Fix building on systems with default LLVM v15 and higher, Arch Linux for example.

shizeeg avatar Apr 16 '23 14:04 shizeeg

while you're at it, why not just recover from finding an unsupported version and try the next one?:

MIN_LLVM_VERSION=("11.0.0")
FIRST_UNSUPPORTED_LLVM_VERSION=("15.0.0")
if [ ! "$LLVM_CONFIG" ]; then
	for THE_LLVM_CONFIG in llvm-config llvm-config-11 llvm-config-11-64 llvm-config-14; do
		if [ ! -x "$(command -v $THE_LLVM_CONFIG)" ]; then
			continue
		fi
		if [ $(version $($THE_LLVM_CONFIG --version)) -lt $(version $MIN_LLVM_VERSION) ] ; then
			echo "Tried to use" $(which $THE_LLVM_CONFIG) "version" $($THE_LLVM_CONFIG --version) \
				": must be at least" $MIN_LLVM_VERSION
			continue
		fi
		if [ $(version $($THE_LLVM_CONFIG --version)) -ge $(version $FIRST_UNSUPPORTED_LLVM_VERSION) ] ; then
			echo "Tried to use" $(which $THE_LLVM_CONFIG) "version" $($THE_LLVM_CONFIG --version) \
				": must be lower than" $FIRST_UNSUPPORTED_LLVM_VERSION
			continue
		fi
		LLVM_CONFIG=$THE_LLVM_CONFIG
		break
	done
fi

if [ ! "$LLVM_CONFIG" ]; then
	panic "Unable to find LLVM-config"
else
	echo "Found " $(which $LLVM_CONFIG) "version" $($LLVM_CONFIG --version)
fi

just a proof of concept, it can probably be simplified a bit

ap29600 avatar Apr 17 '23 18:04 ap29600

This PR is stale and can likely be closed. The build_odin.sh script has been refactored and there's a separate PR to add checks for LLVM14 in https://github.com/odin-lang/Odin/pull/2893. The order of when LLVM14 is checked is important so that Odin always cuts a release with an officially supported version of LLVM as outlined in that PR.

jcmdln avatar Oct 30 '23 18:10 jcmdln