-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: use libwhich to improve installation reliability #24796
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,61 +232,44 @@ julia-base-cache: julia-sysimg-$(JULIA_BUILD_MODE) | $(DIRS) $(build_datarootdir | |
JL_LIBS := julia julia-debug | ||
|
||
# private libraries, that are installed in $(prefix)/lib/julia | ||
JL_PRIVATE_LIBS := ccalltest | ||
JL_PRIVATE_LIBS-0 := libccalltest | ||
ifeq ($(USE_GPL_LIBS), 1) | ||
JL_PRIVATE_LIBS += suitesparse_wrapper | ||
endif | ||
ifeq ($(USE_SYSTEM_PCRE),0) | ||
JL_PRIVATE_LIBS += pcre | ||
JL_PRIVATE_LIBS-0 += libsuitesparse_wrapper | ||
endif | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_PCRE) += libpcre2-8 | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_DSFMT) += libdSFMT | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_GMP) += libgmp | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_MPFR) += libmpfr | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBSSH2) += libssh2 | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_MBEDTLS) += libmbedtls libmbedcrypto libmbedx509 | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_CURL) += libcurl | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBGIT2) += libgit2 | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_ARPACK) += libarpack | ||
ifeq ($(USE_LLVM_SHLIB),1) | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM | ||
endif | ||
|
||
ifeq ($(USE_SYSTEM_OPENLIBM),0) | ||
ifeq ($(USE_SYSTEM_LIBM),0) | ||
JL_PRIVATE_LIBS += openlibm | ||
endif | ||
endif | ||
ifeq ($(USE_SYSTEM_DSFMT),0) | ||
JL_PRIVATE_LIBS += dSFMT | ||
endif | ||
ifeq ($(USE_SYSTEM_BLAS),0) | ||
JL_PRIVATE_LIBS += openblas | ||
else ifeq ($(USE_SYSTEM_LAPACK),0) | ||
JL_PRIVATE_LIBS += lapack | ||
endif | ||
ifeq ($(USE_SYSTEM_GMP),0) | ||
JL_PRIVATE_LIBS += gmp | ||
endif | ||
ifeq ($(USE_SYSTEM_MPFR),0) | ||
JL_PRIVATE_LIBS += mpfr | ||
endif | ||
ifeq ($(USE_SYSTEM_MBEDTLS),0) | ||
JL_PRIVATE_LIBS += mbedtls mbedcrypto mbedx509 | ||
endif | ||
ifeq ($(USE_SYSTEM_LIBSSH2),0) | ||
JL_PRIVATE_LIBS += ssh2 | ||
JL_PRIVATE_LIBS-0 += $(LIBMNAME) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vtjnash I've noticed that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, please fix this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I've filed #29388. |
||
endif | ||
ifeq ($(USE_SYSTEM_CURL),0) | ||
JL_PRIVATE_LIBS += curl | ||
endif | ||
ifeq ($(USE_SYSTEM_LIBGIT2),0) | ||
JL_PRIVATE_LIBS += git2 | ||
endif | ||
ifeq ($(USE_SYSTEM_ARPACK),0) | ||
JL_PRIVATE_LIBS += arpack | ||
|
||
JL_PRIVATE_LIBS-$(USE_SYSTEM_BLAS) += $(LIBBLASNAME) | ||
ifneq ($(LIBLAPACKNAME),$(LIBBLASNAME)) | ||
JL_PRIVATE_LIBS-$(USE_SYSTEM_LAPACK) += $(LIBLAPACKNAME) | ||
endif | ||
ifeq ($(USE_SYSTEM_SUITESPARSE),0) | ||
|
||
ifeq ($(USE_GPL_LIBS), 1) | ||
JL_PRIVATE_LIBS += amd camd ccolamd cholmod colamd umfpack spqr suitesparseconfig | ||
endif | ||
endif | ||
ifeq ($(USE_SYSTEM_LLVM),0) | ||
ifeq ($(USE_LLVM_SHLIB),1) | ||
JL_PRIVATE_LIBS += LLVM | ||
ifeq ($(USE_SYSTEM_SUITESPARSE),0) | ||
JL_PRIVATE_LIBS-0 += libamd libcamd libccolamd libcholmod libcolamd libumfpack libspqr libsuitesparseconfig | ||
endif | ||
endif | ||
|
||
ifeq ($(OS),Darwin) | ||
ifeq ($(USE_SYSTEM_BLAS),1) | ||
ifeq ($(USE_SYSTEM_LAPACK),0) | ||
JL_PRIVATE_LIBS += gfortblas | ||
JL_PRIVATE_LIBS-0 += libgfortblas | ||
endif | ||
endif | ||
endif | ||
|
@@ -342,13 +325,17 @@ endif | |
fi \ | ||
done \ | ||
done | ||
for suffix in $(JL_PRIVATE_LIBS) ; do \ | ||
for lib in $(build_libdir)/lib$${suffix}*.$(SHLIB_EXT)*; do \ | ||
for suffix in $(JL_PRIVATE_LIBS-0) ; do \ | ||
for lib in $(build_libdir)/$${suffix}*.$(SHLIB_EXT)*; do \ | ||
if [ "$${lib##*.}" != "dSYM" ]; then \ | ||
$(INSTALL_M) $$lib $(DESTDIR)$(private_libdir) ; \ | ||
fi \ | ||
done \ | ||
done | ||
for suffix in $(JL_PRIVATE_LIBS-1) ; do \ | ||
lib=$(build_private_libdir)/$${suffix}.$(SHLIB_EXT); \ | ||
$(INSTALL_M) $$lib $(DESTDIR)$(private_libdir) ; \ | ||
done | ||
endif | ||
|
||
# Copy public headers | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,101 @@ else | |
endif | ||
endif | ||
|
||
.PHONY: $(BUILDDIR)/build_h.jl.phony $(BUILDDIR)/version_git.jl.phony clean all | ||
ifneq ($(OS), WINNT) | ||
# For any USE_SYSTEM_* libraries that will be dynamically loaded by libjulia, | ||
# put a symlink in the private libdir. | ||
# System package managers may want to install these links manually, | ||
# but if not, this will try to create the proper symlink to the right minor version. | ||
all: symlink_system_libraries | ||
SYMLINK_SYSTEM_LIBRARIES := | ||
|
||
# if it's a symlink, pick up the symlink target instead, for one level of indirection | ||
resolve_path = \ | ||
$1_wd="`pwd`" && \ | ||
$1_=`readlink -n $${$1} || true` && \ | ||
if [ -n "$${$1_}" ]; then $1_wd=`dirname "$${$1}"`; $1="$${$1_}"; fi | ||
## if it's a relative path, make it an absolute path | ||
resolve_path += && \ | ||
if [ -z "`echo $${$1} | grep '^/'`" ]; then $1=$${$1_wd}/$${$1}; fi | ||
ifeq ($(OS), Darwin) | ||
# try to use the install_name id instead (unless it is an @rpath or such) | ||
# if it's a relative path, make it an absolute path using the working directory from $1, | ||
# while in theory incorrect, this has been observed to be a common build mistake for many libraries | ||
resolve_path += && \ | ||
$1_=`otool -D $${$1} | tail -n +2 | sed -e 's/^@.*$$//'` && \ | ||
if [ -n "$${$1_}" ]; then \ | ||
$1_wd=`dirname "$${$1}"`; $1=$${$1_}; \ | ||
if [ -z "`echo $${$1} | grep '^/'`" ]; then $1=$${$1_wd}/$${$1}; fi; \ | ||
fi | ||
endif | ||
|
||
## debug code: `make resolve-path P=<path to test>` | ||
#resolve_path += && \ | ||
# echo "$${$1_wd} $${$1}" | ||
#resolve-path: | ||
# $(call resolve_path,P) && \ | ||
# echo "$$P" | ||
|
||
define symlink_system_library | ||
symlink_$1: $$(build_private_libdir)/$1.$$(SHLIB_EXT) | ||
$$(build_private_libdir)/$1.$$(SHLIB_EXT): | ||
REALPATH=`$$(call spawn,$$(build_depsbindir)/libwhich) -p $$(notdir $$@)` && \ | ||
$$(call resolve_path,REALPATH) && \ | ||
[ -e "$$$$REALPATH" ] && \ | ||
([ ! -e "$$@" ] || rm "$$@") && \ | ||
echo ln -sf "$$$$REALPATH" "$$@" && \ | ||
ln -sf "$$$$REALPATH" "$$@" | ||
ifneq ($2,) | ||
ifneq ($$(USE_SYSTEM_$2),0) | ||
SYMLINK_SYSTEM_LIBRARIES += symlink_$1 | ||
endif | ||
endif | ||
endef | ||
|
||
# the following excludes: libuv.a, libutf8proc.a, suitesparse* | ||
|
||
$(eval $(call symlink_system_library,$(LIBMNAME))) | ||
ifneq ($(USE_SYSTEM_LIBM),0) | ||
SYMLINK_SYSTEM_LIBRARIES += symlink_$(LIBMNAME) | ||
else ifneq ($(USE_SYSTEM_OPENLIBM),0) | ||
SYMLINK_SYSTEM_LIBRARIES += symlink_$(LIBMNAME) | ||
endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused about this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm calling |
||
|
||
$(eval $(call symlink_system_library,libpcre2-8,PCRE)) | ||
$(eval $(call symlink_system_library,libdSFMT,DSFMT)) | ||
$(eval $(call symlink_system_library,$(LIBBLASNAME),BLAS)) | ||
ifneq ($(LIBLAPACKNAME),$(LIBBLASNAME)) | ||
$(eval $(call symlink_system_library,$(LIBLAPACKNAME),LAPACK)) | ||
endif | ||
$(eval $(call symlink_system_library,libgmp,GMP)) | ||
$(eval $(call symlink_system_library,libmpfr,MPFR)) | ||
$(eval $(call symlink_system_library,libarpack,ARPACK)) | ||
$(eval $(call symlink_system_library,libmbedtls,MBEDTLS)) | ||
$(eval $(call symlink_system_library,libssh2,LIBSSH2)) | ||
$(eval $(call symlink_system_library,libcurl,CURL)) | ||
$(eval $(call symlink_system_library,libgit2,LIBGIT2)) | ||
ifneq ($(DISABLE_LIBUNWIND),0) | ||
$(eval $(call symlink_system_library,libunwind,LIBUNWIND)) | ||
endif | ||
endif # WINNT | ||
|
||
symlink_libLLVM: $(build_private_libdir)/libLLVM.dylib | ||
$(build_private_libdir)/libLLVM.dylib: | ||
REALPATH=`$(LLVM_CONFIG_HOST) --libdir`/libLLVM.$(SHLIB_EXT) && \ | ||
$(call resolve_path,REALPATH) && \ | ||
[ -e "$$REALPATH" ] && \ | ||
([ ! -e "$@" ] || rm "$@") && \ | ||
echo ln -sf "$$REALPATH" "$@" && \ | ||
ln -sf "$$REALPATH" "$@" | ||
ifneq ($(USE_SYSTEM_LLVM),0) | ||
ifneq ($(USE_LLVM_SHLIB),0) | ||
SYMLINK_SYSTEM_LIBRARIES += symlink_libLLVM | ||
endif | ||
endif | ||
|
||
symlink_system_libraries: $(SYMLINK_SYSTEM_LIBRARIES) | ||
|
||
.PHONY: $(BUILDDIR)/build_h.jl.phony $(BUILDDIR)/version_git.jl.phony clean all symlink_* | ||
|
||
clean: | ||
rm -f $(BUILDDIR)/pcre_h.jl | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
22fd8368c7b40209dada50e3205c1294 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6fb77b715d70d9bc95a8546c3bf97bd3677c7ea344b88bb5bc3bbfac9dceabe8a8cde7a0f64dec884cde802e4a3000e30837d3f824b5a9242348c4fe061526a3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## LIBWHICH ## | ||
LIBWHICH_GIT_URL := git://github.com/vtjnash/libwhich.git | ||
LIBWHICH_TAR_URL = https://api.github.com/repos/vtjnash/libwhich/tarball/$1 | ||
$(eval $(call git-external,libwhich,LIBWHICH,,,$(BUILDDIR))) | ||
|
||
LIBWHICH_OBJ_LIB := $(build_depsbindir)/libwhich | ||
|
||
$(BUILDDIR)/$(LIBWHICH_SRC_DIR)/build-compiled: $(BUILDDIR)/$(LIBWHICH_SRC_DIR)/source-extracted | ||
$(MAKE) -C $(dir $<) libwhich | ||
echo 1 > $@ | ||
|
||
$(BUILDDIR)/$(LIBWHICH_SRC_DIR)/build-checked: $(BUILDDIR)/$(LIBWHICH_SRC_DIR)/build-compiled | ||
ifeq ($(OS),$(BUILD_OS)) | ||
$(MAKE) -C $(dir $@) $(LIBWHICH_MFLAGS) check | ||
endif | ||
echo 1 > $@ | ||
|
||
define LIBWHICH_INSTALL | ||
mkdir -p $2/$$(build_depsbindir) | ||
cp $1/libwhich $2/$$(build_depsbindir) | ||
endef | ||
$(eval $(call staged-install, \ | ||
libwhich,$(LIBWHICH_SRC_DIR), \ | ||
LIBWHICH_INSTALL,,,)) | ||
|
||
clean-libwhich: | ||
-rm $(BUILDDIR)/$(LIBWHICH_SRC_DIR)/build-compiled | ||
-$(MAKE) -C $(BUILDDIR)/$(LIBWHICH_SRC_DIR) clean | ||
|
||
get-libwhich: $(LIBWHICH_SRC_FILE) | ||
extract-libwhich: $(BUILDDIR)/$(LIBWHICH_SRC_DIR)/source-extracted | ||
configure-libwhich: extract-libwhich | ||
compile-libwhich: $(BUILDDIR)/$(LIBWHICH_SRC_DIR)/build-compiled | ||
fastcheck-libwhich: check-libwhich | ||
check-libwhich: $(BUILDDIR)/$(LIBWHICH_SRC_DIR)/build-checked |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
LIBWHICH_BRANCH=master | ||
LIBWHICH_SHA1=81e9723c0273d78493dc8c8ed570f68d9ce7e89e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, not essential, just thought it would be useful output (given how much non-useful output we have ...)