Skip to content

Commit 58049ae

Browse files
committed
Apply Carl's patch to avoid Gfortan symbol
See: #82 (comment)
1 parent 7568081 commit 58049ae

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

patches/openblas-make-libs.patch

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/exports/Makefile b/exports/Makefile
2+
index d8173534..4e2e0d7b 100644
3+
--- a/exports/Makefile
4+
+++ b/exports/Makefile
5+
@@ -119,11 +119,21 @@ dll : ../$(LIBDLLNAME)
6+
# in their import table. By instead using a stable name it is possible to
7+
# upgrade between library versions, without needing to re-link an application.
8+
# For more details see: https://github.com/xianyi/OpenBLAS/issues/127.
9+
+ifeq ($(DEBUG), 1)
10+
../$(LIBDLLNAME) : ../$(LIBNAME) $(LIBPREFIX).def dllinit.$(SUFFIX)
11+
$(RANLIB) ../$(LIBNAME)
12+
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
13+
- -shared -o ../$(LIBDLLNAME) -Wl,--out-implib,../$(IMPLIBNAME) \
14+
+ -shared -o ../$(LIBDLLNAME) -Wl,--defsym,quadmath_snprintf=snprintf \
15+
-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
16+
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a
17+
+else
18+
+../$(LIBDLLNAME) : ../$(LIBNAME) $(LIBPREFIX).def dllinit.$(SUFFIX)
19+
+ $(RANLIB) ../$(LIBNAME)
20+
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
21+
+ -shared -o ../$(LIBDLLNAME) -Wl,--defsym,quadmath_snprintf=snprintf -Wl,-gc-sections -Wl,-s \
22+
+ -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
23+
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a
24+
+endif
25+
26+
$(LIBPREFIX).def : $(GENSYM)
27+
./$(GENSYM) win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" $(BUILD_LAPACK_DEPRECATED) $(BUILD_BFLOAT16) $(BUILD_SINGLE) $(BUILD_DOUBLE) $(BUILD_COMPLEX) $(BUILD_COMPLEX16) > $(@F)

tools/build_openblas.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ fi
8585
# Build name for output library from gcc version and OpenBLAS commit.
8686
GCC_TAG="gcc_$(gcc -dumpversion | tr .- _)"
8787
OPENBLAS_VERSION=$(git describe --tags)
88+
# Patch OpenBLAS to exclude stray GFortran symbol.
89+
patch -p1 < ../patches/openblas-make-libs.patch
8890
# Build OpenBLAS
8991
# Variable used in creating output libraries
9092
export LIBNAMESUFFIX=${OPENBLAS_VERSION}-${GCC_TAG}
@@ -113,11 +115,11 @@ cd $openblas_root
113115
# Copy library link file for custom name
114116
cd $build_bits/lib
115117
cp ${our_wd}/OpenBLAS/exports/${DLL_BASENAME}.def ${DLL_BASENAME}.def
116-
# At least for the mingwpy wheel, we have to use the VC tools to build the
117-
# export library. Maybe fixed in later binutils by patch referred to in
118+
119+
# dlltool should work for the following, assuming binutils has patch below:
118120
# https://sourceware.org/ml/binutils/2016-02/msg00002.html
121+
# MSVC equivalent is:
119122
# "lib.exe" /machine:${vc_arch} /def:${DLL_BASENAME}.def
120-
# Maybe this will now work (after 2016 patch above).
121123
dlltool --input-def ${DLL_BASENAME}.def \
122124
--output-exp ${DLL_BASENAME}.exp \
123125
--dllname ${DLL_BASENAME}.dll \

0 commit comments

Comments
 (0)