Skip to content

Commit 483379f

Browse files
committed
fix cross-build, and other build issues
1 parent 027bd4a commit 483379f

File tree

5 files changed

+31
-28
lines changed

5 files changed

+31
-28
lines changed

Make.inc

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ endif
154154
# disable automatic Makefile rules
155155
.SUFFIXES:
156156

157+
# dash `echo` is not well-behaved, so force bash
158+
SHELL = /bin/bash --posix
159+
157160
# find out if git repository is available
158161
ifeq ($(shell [ -e $(JULIAHOME)/.git ] && echo true || echo "Warning: git information unavailable; versioning information limited" >&2), true)
159162
NO_GIT := 0
@@ -587,6 +590,12 @@ endif #USEMSVC
587590
RANLIB := $(CROSS_COMPILE)ranlib
588591
OBJCOPY := $(CROSS_COMPILE)objcopy
589592

593+
ifneq ($(USEMSVC), 1)
594+
CPP_STDOUT := $(CPP) -P
595+
else
596+
CPP_STDOUT := $(CPP) -E
597+
endif
598+
590599
# file extensions
591600
ifeq ($(OS), WINNT)
592601
SHLIB_EXT := dll
@@ -1024,22 +1033,19 @@ JCPPFLAGS+=-DSYSTEM_LLVM
10241033
endif # SYSTEM_LLVM
10251034

10261035
# Windows builds need a little help finding the LLVM libraries for llvm-config
1027-
LLVM_CONFIG_PATH_FIX :=
1028-
ifeq ($(OS),WINNT)
1029-
LLVM_CONFIG_PATH_FIX := PATH="$(build_bindir):$(PATH)"
1036+
# use delayed expansion (= not :=) because spawn isn't defined until later
1037+
LLVM_CONFIG_PATH_FIX =
1038+
ifeq ($(BUILD_OS),WINNT)
1039+
LLVM_CONFIG_PATH_FIX = PATH="$(build_bindir):$(PATH)"
1040+
else ifeq ($(OS),WINNT)
1041+
LLVM_CONFIG_PATH_FIX = WINEPATH="$(call cygpath_w,$(build_bindir));$(WINEPATH)"
10301042
endif
10311043

10321044
ifeq ($(BUILD_OS),$(OS))
10331045
LLVM_CONFIG_HOST := $(LLVM_CONFIG)
10341046
else
10351047
LLVM_CONFIG_HOST := $(basename $(LLVM_CONFIG))-host$(BUILD_EXE)
1036-
ifeq (exists, $(shell [ -f '$(LLVM_CONFIG_HOST)' ] && echo exists ))
1037-
ifeq ($(shell $(LLVM_CONFIG_PATH_FIX) $(LLVM_CONFIG_HOST) --version),3.3)
1038-
# llvm-config-host <= 3.3 is broken, use llvm-config instead (in an emulator)
1039-
# use delayed expansion (= not :=) because spawn isn't defined until later
1040-
LLVM_CONFIG_HOST = $(LLVM_CONFIG_PATH_FIX) $(call spawn,$(LLVM_CONFIG))
1041-
endif
1042-
else
1048+
ifneq (exists, $(shell [ -f '$(LLVM_CONFIG_HOST)' ] && echo exists ))
10431049
# llvm-config-host does not exist (cmake build)
10441050
LLVM_CONFIG_HOST = $(LLVM_CONFIG_PATH_FIX) $(call spawn,$(LLVM_CONFIG))
10451051
endif
@@ -1570,6 +1576,7 @@ PRINT_FLISP = echo '$(subst ','\'',$(1))'; $(1)
15701576
PRINT_JULIA = echo '$(subst ','\'',$(1))'; $(1)
15711577
15721578
endif
1579+
15731580
# Makefile debugging trick:
15741581
# call print-VARIABLE to see the runtime value of any variable
15751582
# (hardened against any special characters appearing in the output)

base/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ include $(JULIAHOME)/Make.inc
66

77
TAGGED_RELEASE_BANNER := ""
88

9-
ifneq ($(USEMSVC), 1)
10-
CPP_STDOUT := $(CPP) -P
11-
else
12-
CPP_STDOUT := $(CPP) -E
13-
endif
14-
159
all: $(addprefix $(BUILDDIR)/,pcre_h.jl errno_h.jl build_h.jl.phony features_h.jl file_constants.jl uv_constants.jl version_git.jl.phony)
1610

1711
PCRE_CONST := 0x[0-9a-fA-F]+|[0-9]+|\([\-0-9]+\)

cli/Makefile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,10 @@ libjulia-debug: $(build_shlibdir)/libjulia-debug.$(SHLIB_EXT)
100100

101101
ifeq ($(OS),WINNT)
102102
# On Windows we need to strip out exported functions from the generated import library.
103-
# On i686, there's an extra underscore at the beginning
104-
ifeq ($(ARCH),i686)
105-
ABI_UNDERSCORE := _\#\#
106-
else
107-
ABI_UNDERSCORE :=
108-
endif
109-
EXPORTED_FUNCS := $(shell echo -e "#include \"jl_exported_funcs.inc\"\n#define XX(x) $(ABI_UNDERSCORE)x\nJL_EXPORTED_FUNCS(XX)" | $(CPP) -I$(JULIAHOME)/src - | tail -n 1)
110-
STRIP_EXPORTED_FUNCS := $(patsubst %,--strip-symbol=%,$(EXPORTED_FUNCS))
103+
STRIP_EXPORTED_FUNCS := $(shell $(CPP_STDOUT) -I$(JULIAHOME)/src $(SRCDIR)/list_strip_symbols.h)
111104
endif
112105

113-
$(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_OBJS) | $(build_shlibdir) $(build_libdir)
106+
$(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_OBJS) $(SRCDIR)/list_strip_symbols.h | $(build_shlibdir) $(build_libdir)
114107
@$(call PRINT_LINK, $(CC) $(call IMPLIB_FLAGS,$@.tmp) $(LOADER_CFLAGS) -DLIBRARY_EXPORTS -shared $(SHIPFLAGS) $(LIB_OBJS) -o $@ \
115108
$(JLIBLDFLAGS) $(LOADER_LDFLAGS) $(RPATH_LIB) $(call SONAME_FLAGS,libjulia.$(JL_MAJOR_SHLIB_EXT)))
116109
@$(INSTALL_NAME_CMD)libjulia.$(SHLIB_EXT) $@
@@ -120,7 +113,7 @@ ifeq ($(OS), WINNT)
120113
@$(call PRINT_ANALYZE, $(OBJCOPY) $(build_libdir)/$(notdir $@).tmp.a $(STRIP_EXPORTED_FUNCS) $(build_libdir)/$(notdir $@).a && rm $(build_libdir)/$(notdir $@).tmp.a)
121114
endif
122115

123-
$(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_DOBJS) | $(build_shlibdir) $(build_libdir)
116+
$(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_DOBJS) $(SRCDIR)/list_strip_symbols.h | $(build_shlibdir) $(build_libdir)
124117
@$(call PRINT_LINK, $(CC) $(call IMPLIB_FLAGS,$@.tmp) $(LOADER_CFLAGS) -DLIBRARY_EXPORTS -shared $(DEBUGFLAGS) $(LIB_DOBJS) -o $@ \
125118
$(JLIBLDFLAGS) $(LOADER_LDFLAGS) $(RPATH_LIB) $(call SONAME_FLAGS,libjulia-debug.$(JL_MAJOR_SHLIB_EXT)))
126119
@$(INSTALL_NAME_CMD)libjulia-debug.$(SHLIB_EXT) $@.tmp

cli/list_strip_symbols.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file is a part of Julia. License is MIT: https://julialang.org/license
2+
3+
#include "jl_exported_funcs.inc"
4+
#include "trampolines/common.h"
5+
#define XX(x) --strip-symbol=CNAME(x)
6+
JL_EXPORTED_FUNCS(XX)
7+
#undef XX

src/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,13 @@ DEBUGFLAGS += "-DJL_LIBJULIA_SONAME=\"libjulia-debug.$(JL_MAJOR_SHLIB_EXT)\"" "-
140140

141141
ifeq ($(USE_CROSS_FLISP), 1)
142142
FLISPDIR := $(BUILDDIR)/flisp/host
143+
FLISP_EXECUTABLE_debug := $(FLISPDIR)/flisp-debug$(BUILD_EXE)
144+
FLISP_EXECUTABLE_release := $(FLISPDIR)/flisp$(BUILD_EXE)
143145
else
144146
FLISPDIR := $(BUILDDIR)/flisp
147+
FLISP_EXECUTABLE_debug := $(FLISPDIR)/flisp-debug$(EXE)
148+
FLISP_EXECUTABLE_release := $(FLISPDIR)/flisp$(EXE)
145149
endif
146-
FLISP_EXECUTABLE_debug := $(FLISPDIR)/flisp-debug$(BUILD_EXE)
147-
FLISP_EXECUTABLE_release := $(FLISPDIR)/flisp$(BUILD_EXE)
148150
ifeq ($(OS),WINNT)
149151
FLISP_EXECUTABLE := $(FLISP_EXECUTABLE_release)
150152
else

0 commit comments

Comments
 (0)