Skip to content

Commit 9c4286c

Browse files
committed
Upgrade BB triplet naming from -gccX tags to -libgfortranX tags.
This will require us to change our LLVM and OpenBLAS binaries, as they are the only libgfortran-specific libraries that we ship with base Julia.
1 parent e4d0808 commit 9c4286c

File tree

3 files changed

+26
-33
lines changed

3 files changed

+26
-33
lines changed

contrib/normalize_triplet.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@
3131
'blank_call_abi': "",
3232
'eabihf': "eabihf",
3333
}
34-
gcc_version_mapping = {
35-
'blank_gcc': "",
36-
'gcc4': "-gcc4",
37-
'gcc7': "-gcc7",
38-
'gcc8': "-gcc8",
39-
'gcc9': "-gcc8",
34+
libgfortran_version_mapping = {
35+
'blank_libgfortran': "",
36+
'libgfortran3': "-libgfortran3",
37+
'libgfortran4': "-libgfortran4",
38+
'libgfortran5': "-libgfortran5",
4039
}
4140
cxx_abi_mapping = {
4241
'blank_cxx_abi': "",
@@ -53,7 +52,7 @@
5352
c(platform_mapping)+
5453
c(libc_mapping)+
5554
c(call_abi_mapping)+
56-
c(gcc_version_mapping)+
55+
c(libgfortran_version_mapping)+
5756
c(cxx_abi_mapping)+
5857
"$"
5958
)
@@ -76,7 +75,7 @@ def get_field(m, mapping):
7675
platform = get_field(m, platform_mapping)
7776
libc = get_field(m, libc_mapping)
7877
call_abi = get_field(m, call_abi_mapping)
79-
gcc_version = get_field(m, gcc_version_mapping)
78+
libgfortran_version = get_field(m, libgfortran_version_mapping)
8079
cxx_abi = get_field(m, cxx_abi_mapping)
8180

8281
# The default libc on Linux is glibc
@@ -85,7 +84,7 @@ def get_field(m, mapping):
8584

8685
def r(x):
8786
x = x.replace("blank_call_abi", "")
88-
x = x.replace("blank_gcc", "")
87+
x = x.replace("blank_libgfortran", "")
8988
x = x.replace("blank_cxx_abi", "")
9089
x = x.replace("blank_libc", "")
9190
return x
@@ -106,17 +105,17 @@ def p(x):
106105
return x
107106

108107
# If the user passes in a GCC version (like 8.2.0) use that to force a
109-
# "-gcc8" tag at the end of the triplet, but only if it has otherwise
108+
# "-libgfortran5" tag at the end of the triplet, but only if it has otherwise
110109
# not been specified
111-
if gcc_version == "blank_gcc":
110+
if libgfortran_version == "blank_libgfortran":
112111
if len(sys.argv) >= 3:
113-
gcc_version = {
114-
"4": "gcc4",
115-
"5": "gcc4",
116-
"6": "gcc4",
117-
"7": "gcc7",
118-
"8": "gcc8",
119-
"9": "gcc8",
112+
libgfortran_version = {
113+
"4": "libgfortran3",
114+
"5": "libgfortran3",
115+
"6": "libgfortran3",
116+
"7": "libgfortran4",
117+
"8": "libgfortran5",
118+
"9": "libgfortran5",
120119
}[list(filter(lambda x: re.match("\d+\.\d+(\.\d+)?", x), sys.argv[2].split()))[-1][0]]
121120

122121
if cxx_abi == "blank_cxx_abi":
@@ -127,7 +126,7 @@ def p(x):
127126
"": "",
128127
}[sys.argv[3]]
129128

130-
print(arch+p(platform)+p(libc)+r(call_abi)+p(gcc_version)+p(cxx_abi))
129+
print(arch+p(platform)+p(libc)+r(call_abi)+p(libgfortran_version)+p(cxx_abi))
131130

132131
# Testing suite:
133132
# triplets="i686-w64-mingw32 x86_64-pc-linux-musl arm-linux-musleabihf x86_64-linux-gnu arm-linux-gnueabihf x86_64-apple-darwin14 x86_64-unknown-freebsd11.1"

contrib/refresh_bb_tarballs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ for triplet in ${TRIPLETS}; do
4040

4141
for proj in ${BB_GCC_EXPANDED_PROJECTS}; do
4242
PROJ="$(echo ${proj} | tr [a-z] [A-Z])"
43-
for gcc in gcc4 gcc7 gcc8; do
44-
make -C "${CONTRIB_DIR}/../deps" USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${gcc} BB_TRIPLET_CXXABI=${triplet} distclean-${proj}
45-
make -C "${CONTRIB_DIR}/../deps" USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${gcc} BB_TRIPLET_CXXABI=${triplet} install-${proj}
43+
for libgfortran in libgfortran3 libgfortran4 libgfortran5; do
44+
make -C "${CONTRIB_DIR}/../deps" USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${libgfortran} BB_TRIPLET_CXXABI=${triplet} distclean-${proj}
45+
make -C "${CONTRIB_DIR}/../deps" USE_BINARYBUILDER_${PROJ}=1 ${PROJ}_BB_TRIPLET=${triplet}-${libgfortran} BB_TRIPLET_CXXABI=${triplet} install-${proj}
4646
done
4747
done
4848
done

deps/tools/bb-install.mk

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
# Auto-detect triplet once, create different versions that we use as defaults below for each BB install target
88
# This is much more efficient than launching `gcc` and `python` once for each BB install target.
9-
BB_TRIPLET_GCCABI_CXXABI := $(shell python $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) "$(shell $(FC) --version | head -1)" "$(shell echo '\#include <string>' | $(CXX) $(CXXFLAGS) -x c++ -dM -E - | grep _GLIBCXX_USE_CXX11_ABI | awk '{ print $$3 }' )")
10-
BB_TRIPLET_GCCABI := $(subst $(SPACE),-,$(filter-out cxx%,$(subst -,$(SPACE),$(BB_TRIPLET_GCCABI_CXXABI))))
11-
BB_TRIPLET_CXXABI := $(subst $(SPACE),-,$(filter-out gcc%,$(subst -,$(SPACE),$(BB_TRIPLET_GCCABI_CXXABI))))
12-
BB_TRIPLET := $(subst $(SPACE),-,$(filter-out cxx%,$(filter-out gcc%,$(subst -,$(SPACE),$(BB_TRIPLET_GCCABI_CXXABI)))))
9+
BB_TRIPLET_LIBGFORTRAN_CXXABI := $(shell python $(JULIAHOME)/contrib/normalize_triplet.py $(or $(XC_HOST),$(XC_HOST),$(BUILD_MACHINE)) "$(shell $(FC) --version | head -1)" "$(shell echo '\#include <string>' | $(CXX) $(CXXFLAGS) -x c++ -dM -E - | grep _GLIBCXX_USE_CXX11_ABI | awk '{ print $$3 }' )")
10+
BB_TRIPLET_LIBGFORTRAN := $(subst $(SPACE),-,$(filter-out cxx%,$(subst -,$(SPACE),$(BB_TRIPLET_LIBGFORTRAN_CXXABI))))
11+
BB_TRIPLET_CXXABI := $(subst $(SPACE),-,$(filter-out libgfortran%,$(subst -,$(SPACE),$(BB_TRIPLET_LIBGFORTRANABI_CXXABI))))
12+
BB_TRIPLET := $(subst $(SPACE),-,$(filter-out cxx%,$(filter-out libgfortran%,$(subst -,$(SPACE),$(BB_TRIPLET_LIBGFORTRAN_CXXABI)))))
1313

1414
define bb-install
1515
TRIPLET_VAR := BB_TRIPLET
1616
ifeq ($(3),true)
17-
TRIPLET_VAR := $$(TRIPLET_VAR)_GCCABI
17+
TRIPLET_VAR := $$(TRIPLET_VAR)_LIBGFORTRAN
1818
endif
1919
ifeq ($(4),true)
2020
TRIPLET_VAR := $$(TRIPLET_VAR)_CXXABI
@@ -60,12 +60,6 @@ check-$(1):
6060

6161
.PHONY: clean-bb-$(1)
6262

63-
# Sanity check to see if we are trying to use a `gcc4` tarball on a system that wants `cxx11` strings:
64-
ifeq ($$(lastword $$(subst -,$$(SPACE),$$($(2)_BB_TRIPLET))),gcc4)
65-
ifeq ($$(lastword $$(subst -,$$(SPACE),$$(BB_TRIPLET_CXXABI))),cxx11)
66-
$$(error Attempting to use gcc4 $(2) tarball, but compiling with cxx11 string ABI; set "CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0" to avoid linker errors)
67-
endif
68-
endif
6963
endef
7064

7165
define bb-uninstaller

0 commit comments

Comments
 (0)