@@ -76,7 +76,7 @@ fflags="$fextra $cflags -frecursive -ffpe-summary=invalid,zero"
7676
7777# Set suffixed-ILP64 flags
7878if [ " $if_bits " == " 64" ]; then
79- SYMBOLSUFFIX =" 64_"
79+ LIBNAMESUFFIX =" 64_"
8080 interface_flags=" INTERFACE64=1 SYMBOLSUFFIX=64_ LIBNAMESUFFIX=64_"
8181 # We override FCOMMON_OPT, so we need to set default integer manually
8282 fflags=" $fflags -fdefault-integer-8"
@@ -90,8 +90,12 @@ interface_flags="$interface_flags SYMBOLPREFIX=scipy_ LIBNAMEPREFIX=scipy_ FIXED
9090# Build name for output library from gcc version and OpenBLAS commit.
9191GCC_TAG=" gcc_$( gcc -dumpversion | tr .- _) "
9292OPENBLAS_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+
9398# Build OpenBLAS
94- # Variable used in creating output libraries
9599make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
96100 NUM_THREADS=24 NO_WARMUP=1 NO_AFFINITY=1 CONSISTENT_FPCSR=1 \
97101 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 \
100104 FCOMMON_OPT=" $fflags " \
101105 MAX_STACK_ALLOC=2048 \
102106 $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+
103136make 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
105139
106140# OpenBLAS does not build a symbol-suffixed static library on Windows:
107141# do it ourselves. On 32-bit builds, the objcopy.def names need a '_' prefix
@@ -143,16 +177,8 @@ else
143177 sed -e " s/^Cflags.*/\0 -DBLAS_SYMBOL_PREFIX=scipy_/" -i pkgconfig/scipy-openblas.pc
144178fi
145179popd
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-
154180ls $openblas_root /$build_bits /lib
155181
156- zip_name=" openblas${SYMBOLSUFFIX } -${OPENBLAS_VERSION} -${plat_tag} -${GCC_TAG} .zip"
182+ zip_name=" openblas${LIBNAMESUFFIX } -${OPENBLAS_VERSION} -${plat_tag} -${GCC_TAG} .zip"
157183zip -r $zip_name $build_bits
158184cp $zip_name ${builds_dir}
0 commit comments