@@ -76,7 +76,7 @@ fflags="$fextra $cflags -frecursive -ffpe-summary=invalid,zero"
76
76
77
77
# Set suffixed-ILP64 flags
78
78
if [ " $if_bits " == " 64" ]; then
79
- SYMBOLSUFFIX =" 64_"
79
+ LIBNAMESUFFIX =" 64_"
80
80
interface_flags=" INTERFACE64=1 SYMBOLSUFFIX=64_ LIBNAMESUFFIX=64_"
81
81
# We override FCOMMON_OPT, so we need to set default integer manually
82
82
fflags=" $fflags -fdefault-integer-8"
@@ -90,8 +90,12 @@ interface_flags="$interface_flags SYMBOLPREFIX=scipy_ LIBNAMEPREFIX=scipy_ FIXED
90
90
# Build name for output library from gcc version and OpenBLAS commit.
91
91
GCC_TAG=" gcc_$( gcc -dumpversion | tr .- _) "
92
92
OPENBLAS_VERSION=$( git describe --tags --abbrev=8)
93
+
94
+ # Patch OpenBLAS build to resolve all symbols and avoid linking
95
+ # with libquadmath
96
+ patch -p1 < ../patches-windows/openblas-make-libs.patch
97
+
93
98
# Build OpenBLAS
94
- # Variable used in creating output libraries
95
99
make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
96
100
NUM_THREADS=24 NO_WARMUP=1 NO_AFFINITY=1 CONSISTENT_FPCSR=1 \
97
101
BUILD_LAPACK_DEPRECATED=1 TARGET=PRESCOTT BUFFERSIZE=20\
@@ -100,8 +104,38 @@ make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
100
104
FCOMMON_OPT=" $fflags " \
101
105
MAX_STACK_ALLOC=2048 \
102
106
$interface_flags
107
+
108
+ # Make sure quadmath library is not statically linked in to the DLL by checking
109
+ # the output.map generated by the linker when using `-Wl,-gc-sections -Wl,-s`
110
+ # the map will have libname(o-filename) for each function pulled out of the
111
+ # library libname
112
+ # The file itself appears in the map, so look for "libquadmath.a(". Use '-A 3'
113
+ # to show a bit of context if any symbols appear (which should not happen)
114
+ set +e
115
+ grep -A 2 " libquadmath.a(" exports/output.map
116
+ case $? in
117
+ 0)
118
+ echo " link uses libquadmath.a when it should not"
119
+ exit -1
120
+ ;;
121
+ 1)
122
+ if [ -f exports/output.map ]; then
123
+ echo " Good, verified no 'libquadmath' used when linking"
124
+ else
125
+ echo " error occurred"
126
+ exit -1
127
+ fi
128
+ ;;
129
+ * )
130
+ echo " grep returned $? , error occurred"
131
+ exit -1
132
+ ;;
133
+ esac
134
+ set -e
135
+
103
136
make PREFIX=$openblas_root /$build_bits $interface_flags install
104
- DLL_BASENAME=libscipy_openblas${SYMBOLSUFFIX}${LIBNAMESUFFIX}
137
+ DLL_BASENAME=libscipy_openblas${LIBNAMESUFFIX}
138
+ cp -f * .dll.a $openblas_root /$build_bits /lib/${DLL_BASENAME} .dll.a
105
139
106
140
# OpenBLAS does not build a symbol-suffixed static library on Windows:
107
141
# do it ourselves. On 32-bit builds, the objcopy.def names need a '_' prefix
@@ -143,16 +177,8 @@ else
143
177
sed -e " s/^Cflags.*/\0 -DBLAS_SYMBOL_PREFIX=scipy_/" -i pkgconfig/scipy-openblas.pc
144
178
fi
145
179
popd
146
- # Build template site.cfg for using this build
147
- cat > ${build_bits} /site.cfg.template << EOF
148
- [openblas${SYMBOLSUFFIX} ]
149
- libraries = $DLL_BASENAME
150
- library_dirs = {openblas_root}\\ ${build_bits} \\ lib
151
- include_dirs = {openblas_root}\\ ${build_bits} \\ include
152
- EOF
153
-
154
180
ls $openblas_root /$build_bits /lib
155
181
156
- zip_name=" openblas${SYMBOLSUFFIX } -${OPENBLAS_VERSION} -${plat_tag} -${GCC_TAG} .zip"
182
+ zip_name=" openblas${LIBNAMESUFFIX } -${OPENBLAS_VERSION} -${plat_tag} -${GCC_TAG} .zip"
157
183
zip -r $zip_name $build_bits
158
184
cp $zip_name ${builds_dir}
0 commit comments