Skip to contentSkip to conversation

build: fix LLVM version detection

PATCH In review Quentin Monnet 2 participants 2 messages Apr 20, 2020 – May 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: fix LLVM version detection

The regex match used for detecting the LLVM version works for versions with a single-digit major number. Now that LLVM v10 is out, detection can fail, resulting in sparse-llvm not being built.

Fix detection by extracting the major version number to compare with the minimum supported.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 85d15edca948..e93cfd66d0c9 100644
@@ -183,7 +183,8 @@ arch := x32
 endif
 ifneq ($(filter ${arch},i386 i486 i586 i686 x86_64 amd64),)
 LLVM_VERSION:=$(shell $(LLVM_CONFIG) --version)
-ifeq ($(shell expr "$(LLVM_VERSION)" : '[3-9]\.'),2)
+LLVM_VERSION_MAJOR:=$(firstword $(subst ., ,$(LLVM_VERSION)))
+ifeq ($(shell expr "$(LLVM_VERSION_MAJOR)" '>=' 3),1)
 LLVM_PROGS := sparse-llvm
 $(LLVM_PROGS): LD := g++
 LLVM_LDFLAGS := $(shell $(LLVM_CONFIG) --ldflags)
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Quentin Monnet

The regex match used for detecting the LLVM version works for versions with a single-digit major number. Now that LLVM v10 is out, detection can fail, resulting in sparse-llvm not being built.

Fix detection by extracting the major version number to compare with the minimum supported.

Sorry for the late reply.
Applied & pushed. Thanks.

-- Luc