Skip to content

Commit f484978

Browse files
committed
Fix llvm-ar detection for macOS builds
The original assumed that Clang always provides llvm-ar, which fails on macOS where Apple Clang is the default compiler but doesn't include llvm-ar. This causes build failures when ENABLE_EXT_F=1. Add runtime detection using 'which llvm-ar' to check availability before using it. Falls back to system 'ar' when llvm-ar is not found, ensuring builds work correctly with both Apple Clang and Homebrew LLVM.
1 parent 65a1ec6 commit f484978

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ $(call set-feature, EXT_F)
116116
ifeq ($(call has, EXT_F), 1)
117117
AR := ar
118118
ifeq ("$(CC_IS_CLANG)", "1")
119-
AR = llvm-ar
119+
# Check if llvm-ar is available
120+
LLVM_AR := $(shell which llvm-ar 2>/dev/null)
121+
ifneq ($(LLVM_AR),)
122+
AR = llvm-ar
123+
endif
120124
endif
121125
ifeq ("$(CC_IS_EMCC)", "1")
122126
AR = emar

0 commit comments

Comments
 (0)