Skip to content

Commit

Permalink
[build system]: Fix USE_SYSTEM_LIBM=1 build (#37832)
Browse files Browse the repository at this point in the history
  • Loading branch information
staticfloat authored Oct 14, 2020
1 parent ae2c61d commit a8d0968
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,15 @@ endif
# On Windows, we want shared library files to end up in $(build_bindir), instead of $(build_libdir)
# We also don't really have a private bindir on windows right now, due to lack of RPATH.
ifeq ($(OS),WINNT)
build_shlibdir := $(build_bindir)
shlibdir := $(bindir)
private_shlibdir := $(bindir)
build_shlibdir := $(build_bindir)
build_private_shlibdir := $(build_bindir)
else
build_shlibdir := $(build_libdir)
shlibdir := $(libdir)
private_shlibdir := $(private_libdir)
build_shlibdir := $(build_libdir)
build_private_shlibdir := $(build_private_libdir)
endif

# If we're on windows, don't do versioned shared libraries. If we're on OSX,
Expand Down Expand Up @@ -1489,21 +1491,25 @@ LIBGCC_NAME := libgcc_s_sjlj-1.$(SHLIB_EXT)
else
LIBGCC_NAME := libgcc_s_seh-1.$(SHLIB_EXT)
endif
LIBOPENLIBM_NAME := libopenlibm.$(SHLIB_EXT)
endif
ifeq ($(OS),Darwin)
LIBGCC_NAME := libgcc_s.1.$(SHLIB_EXT)
LIBOPENLIBM_NAME := libopenlibm.3.$(SHLIB_EXT)
endif
ifneq ($(findstring $(OS),Linux FreeBSD),)
LIBGCC_NAME := libgcc_s.$(SHLIB_EXT).1
LIBOPENLIBM_NAME := libopenlibm.$(SHLIB_EXT).3
endif


LIBGCC_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/$(LIBGCC_NAME))
LIBGCC_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(private_shlibdir)/$(LIBGCC_NAME))
LIBOPENLIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/$(LIBOPENLIBM_NAME))
LIBOPENLIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(private_shlibdir)/$(LIBOPENLIBM_NAME))

# USE_SYSTEM_LIBM causes it to get symlinked into build_private_shlibdir
ifeq ($(USE_SYSTEM_LIBM),1)
LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
else
LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
endif
LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))

# We list:
# * libgcc_s, because FreeBSD needs to load ours, not the system one.
Expand All @@ -1514,10 +1520,10 @@ LIBOPENLIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(private_shlibdir)/
# * debug builds must link against libjuliadebug, not libjulia
# * install time relative paths are not equal to build time relative paths (../lib vs. ../lib/julia)
# That second point will no longer be true for most deps once they are placed within Artifacts directories.
LOADER_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBOPENLIBM_BUILD_DEPLIB):$(LIBJULIA_BUILD_DEPLIB)
LOADER_DEBUG_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBOPENLIBM_BUILD_DEPLIB):$(LIBJULIA_DEBUG_BUILD_DEPLIB)
LOADER_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBOPENLIBM_INSTALL_DEPLIB):$(LIBJULIA_INSTALL_DEPLIB)
LOADER_DEBUG_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBOPENLIBM_INSTALL_DEPLIB):$(LIBJULIA_DEBUG_INSTALL_DEPLIB)
LOADER_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBM_BUILD_DEPLIB):$(LIBJULIA_BUILD_DEPLIB)
LOADER_DEBUG_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBM_BUILD_DEPLIB):$(LIBJULIA_DEBUG_BUILD_DEPLIB)
LOADER_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBM_INSTALL_DEPLIB):$(LIBJULIA_INSTALL_DEPLIB)
LOADER_DEBUG_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBM_INSTALL_DEPLIB):$(LIBJULIA_DEBUG_INSTALL_DEPLIB)

# Colors for make
ifndef VERBOSE
Expand Down

0 comments on commit a8d0968

Please sign in to comment.