Skip to content

Commit

Permalink
copy dll.a differently
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Aug 6, 2024
1 parent 261b95e commit 3aefe48
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
16 changes: 8 additions & 8 deletions patches-windows/openblas-make-libs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ index 668a4866e..956b51bf4 100644
+++ b/exports/Makefile
@@ -126,8 +126,9 @@ dll : ../$(LIBDLLNAME)
../$(LIBDLLNAME) : ../$(LIBNAME) $(LIBPREFIX).def dllinit.$(SUFFIX)
$(RANLIB) ../$(LIBNAME)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
- -shared -o ../$(LIBDLLNAME) -Wl,--out-implib,../$(IMPLIBNAME) \
+ -shared -o ../$(LIBDLLNAME) -Wl,-gc-sections -Wl,-s -Wl,-Map,output.map \
-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a

$(RANLIB) ../$(LIBNAME)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
- -shared -o ../$(LIBDLLNAME) -Wl,--out-implib,../$(IMPLIBNAME) \
+ -shared -o ../$(LIBDLLNAME) -Wl,-gc-sections -Wl,-s -Wl,-Map,output.map \
-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a
$(LIBPREFIX).def : $(GENSYM)
./$(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)
./$(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)
35 changes: 17 additions & 18 deletions tools/build_openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ git submodule update --init --recursive


# Get / clean code
# git fetch origin
# if [ -n "$OPENBLAS_COMMIT" ]; then
# git checkout $OPENBLAS_COMMIT
# fi
# git clean -fxd
# git reset --hard
git fetch origin
if [ -n "$OPENBLAS_COMMIT" ]; then
git checkout $OPENBLAS_COMMIT
fi
git clean -fxd
git reset --hard
rm -rf $openblas_root/$build_bits

# Set architecture flags
Expand Down Expand Up @@ -90,13 +90,14 @@ interface_flags="$interface_flags SYMBOLPREFIX=scipy_ LIBNAMEPREFIX=scipy_ FIXED
# Build name for output library from gcc version and OpenBLAS commit.
GCC_TAG="gcc_$(gcc -dumpversion | tr .- _)"
OPENBLAS_VERSION=$(git describe --tags --abbrev=8)
# Patch OpenBLAS to exclude stray GFortran symbol.
# Replacement snprintf symbol only present for UCRTC 64-bit build.
# if [ "$BUILD_BITS" == 64 ]; then
# patch -p1 < ../patches-windows/openblas-make-libs.patch
# fi

# Patch OpenBLAS build to resolve all symbols and avoid linking
# with libquadmath
if [ "$BUILD_BITS" == 64 ]; then
patch -p1 < ../patches-windows/openblas-make-libs.patch
fi

# Build OpenBLAS
# Variable used in creating output libraries
make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
NUM_THREADS=24 NO_WARMUP=1 NO_AFFINITY=1 CONSISTENT_FPCSR=1 \
BUILD_LAPACK_DEPRECATED=1 TARGET=PRESCOTT BUFFERSIZE=20\
Expand All @@ -107,12 +108,10 @@ make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
$interface_flags
make PREFIX=$openblas_root/$build_bits $interface_flags install
DLL_BASENAME=libscipy_openblas${LIBNAMESUFFIX}
if [ -f "${DLL_BASENAME}.dll.a" ]; then
cp -f "${DLL_BASENAME}.dll.a" "$openblas_root/$build_bits/lib/"
else
# 32-bit build somehow does not put scipy_ into the import lib name
cp -f "libopenblas.dll.a" "$openblas_root/$build_bits/lib/"
fi
echo ------
ls *.dll.a
echo ------
cp -f *.dll.a $openblas_root/$build_bits/lib/{DLL_BASENAME}.dll.a

# OpenBLAS does not build a symbol-suffixed static library on Windows:
# do it ourselves. On 32-bit builds, the objcopy.def names need a '_' prefix
Expand Down

0 comments on commit 3aefe48

Please sign in to comment.