Skip to content

Commit

Permalink
Only use llvm-config for library selection when building against syst…
Browse files Browse the repository at this point in the history
…em LLVM. (#30459)
  • Loading branch information
maleadt authored and ararslan committed Dec 21, 2018
1 parent 7c3904a commit 7acb991
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,15 @@ endif
endif # WINNT

symlink_libLLVM: $(build_private_libdir)/libLLVM.dylib
ifneq ($(USE_SYSTEM_LLVM),0)
LLVM_CONFIG_HOST_LIBS := $(shell $(LLVM_CONFIG_HOST) --libfiles)
# HACK: llvm-config doesn't correctly point to shared libs on all platforms
# https://github.com/JuliaLang/julia/issues/29981
else
LLVM_CONFIG_HOST_LIBS := $(shell $(LLVM_CONFIG_HOST) --libdir)/libLLVM.$(SHLIB_EXT)
endif
$(build_private_libdir)/libLLVM.dylib:
REALPATH=`$(LLVM_CONFIG_HOST) --libfiles` && \
REALPATH=$(LLVM_CONFIG_HOST_LIBS) && \
$(call resolve_path,REALPATH) && \
[ -e "$$REALPATH" ] && \
([ ! -e "$@" ] || rm "$@") && \
Expand Down
10 changes: 10 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,17 @@ endif
PUBLIC_HEADER_TARGETS := $(addprefix $(build_includedir)/julia/,$(notdir $(PUBLIC_HEADERS)) $(UV_HEADERS))

ifeq ($(JULIACODEGEN),LLVM)
ifneq ($(USE_SYSTEM_LLVM),0)
LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags --libs --system-libs)
# HACK: llvm-config doesn't correctly point to shared libs on all platforms
# https://github.com/JuliaLang/julia/issues/29981
else
ifneq ($(USE_LLVM_SHLIB),1)
LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags) $(shell $(LLVM_CONFIG_HOST) --libs $(LLVM_LIBS)) $(shell $(LLVM_CONFIG_HOST) --ldflags) $(shell $(LLVM_CONFIG_HOST) --system-libs 2> /dev/null)
else
LLVMLINK += $(shell $(LLVM_CONFIG_HOST) --ldflags) -lLLVM
endif
endif
ifeq ($(USE_LLVM_SHLIB),1)
FLAGS += -DLLVM_SHLIB
endif # USE_LLVM_SHLIB == 1
Expand Down

0 comments on commit 7acb991

Please sign in to comment.