Skip to content

Commit

Permalink
fix up grep result checking, use patch on 32-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Aug 6, 2024
1 parent 3aefe48 commit e0ab028
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions tools/build_openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ OPENBLAS_VERSION=$(git describe --tags --abbrev=8)

# 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
patch -p1 < ../patches-windows/openblas-make-libs.patch

# Build OpenBLAS
make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
Expand All @@ -108,10 +106,7 @@ 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}
echo ------
ls *.dll.a
echo ------
cp -f *.dll.a $openblas_root/$build_bits/lib/{DLL_BASENAME}.dll.a
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 All @@ -134,22 +129,30 @@ cp -f "${static_libname}.renamed" "$openblas_root/$build_bits/lib/${DLL_BASENAME
# Make sure quadmath library is not statically linked in to the DLL by checking
# the output.map generated by the linker when using `-Wl,-gc-sections -Wl,-s`
# the map will have libname(o-filename) for each function pulled out of the
# library
# The file itself appears in the map
grep -A 3 "libquadmath.a(" output.map
# library libname
# The file itself appears in the map, so look for "libquadmath.a(". Use '-A 3'
# to show a bit of context if any symbols appear (which should not happen)
set +e
grep -A 3 "libquadmath.a(" exports/output.map
case $? in
0)
echo "link uses libquadmath.a when it should not"
exit -1
;;
2)
echo "could not find 'output.map' to verify linking avoids libquadmath.a"
exit -1
echo "link uses libquadmath.a when it should not"
exit -1
;;
1)
echo "verified no 'libquadmath' used when linking"
if [ -f exports/output.map ]; then
echo "Good, verified no 'libquadmath' used when linking"
else
echo "error occurred"
exit -1
fi
;;
*)
echo "grep returned $?, error occurred"
exit -1
;;
esac
set -e

cd $openblas_root
# Copy library link file for custom name
Expand Down

0 comments on commit e0ab028

Please sign in to comment.