Issues with the latest versions of openblas (0.3.13-1+)

Problems with packages? Post here, using [tags] of the package name.

Issues with the latest versions of openblas (0.3.13-1+)

Postby Feakster » Fri Jan 08, 2021 6:43 pm

Has anyone else had issues using the latest version of openblas with R? When trying to launch R, I got the following error message:

Code: Select all
/usr/lib/R/bin/exec/R: error while loading shared libraries: libblas.so.3: cannot open shared object file: No such file or directory


I had to downgrade openblas to version 0.3.12-1 in order to get R to launch as expected.
Feakster
 
Posts: 7
Joined: Wed Nov 11, 2020 9:49 am

Re: Issues with the latest versions of openblas (0.3.13-1+)

Postby Feakster » Tue Jan 12, 2021 5:44 pm

The issue seems to revolve around the shared object for libopenblas having the build target randomly shoved in it's name in builds using upstream versions of openblas >= 0.3.13. Hence, the symlinking for libblas.so & libblas.so.3 fails, as the target the symlinks point to no longer exists.
Last edited by Feakster on Tue Jan 26, 2021 10:09 am, edited 1 time in total.
Feakster
 
Posts: 7
Joined: Wed Nov 11, 2020 9:49 am

Re: Issues with the latest versions of openblas (0.3.13-1+)

Postby Feakster » Wed Jan 13, 2021 8:10 pm

I've been faffing with the PKGBUILD to try some things & have made a few modifications:

  • - Bump in package release.
  • - Added 'openmp' to the "depends" array, as it's listed as an option the "make" step.
  • - Removed 'perl' from the "makedepends" array. I presume 'perl' was added by accident for the 'sed' commands.
  • - Altered the "arch" array to reflect the ARM build targets.
  • - Moved the makefile erasure and "TARGET" detection steps to the prepare() function.
  • - Refactored the "TARGET" detection sequence to use if else. The previous sequence would trigger errors where it formed the last call of a function. There's probably an obvious reason for this, but I lack the bash skills to fix it, so I changed it.
  • - Added the 'DYNAMIC_ARCH=1' option for aarch64 architecture. When the TARGET is set to ARMV8, this seems to result in openblas being compiled for all ARMv8 cortex targets, which does increase the build time somewhat, but may have performance benefits. I haven't been able to test this, but welcome feedback.
  • - Restructured the package() function to more strictly adhere to library naming conventions, and to deal with issues arising from build targets being shoved in the middle of the library names for some combinations of build parameters (but not others).
  • - Removed some unnecessary options from the 'make install' line as they weren't doing anything.
  • - Removed the '-e' option from all 'sed' commands, as it's not required here (no multiple expression 'sed' calls.)
  • - Restructured the package() function.
  • - Added comments.
  • - Added myself to the Contributors section (as I think I've now spend enough time on this).

Code: Select all
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Giuseppe Borzi <gborzi _AT_ ieee _DOT_ org>
# Contributor: Feakster <feakster at posteo dot eu>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - set build targets
#  - clear Makefile.arm (bad cflags overrides)

pkgname=openblas
_pkgname=OpenBLAS
pkgver=0.3.13
pkgrel=2.2
pkgdesc='An optimized BLAS library based on GotoBLAS2 1.13 BSD'
arch=('arm' 'armv6h' 'armv7h' 'aarch64')
url='https://www.openblas.net/'
license=('BSD') # BSD 3-clause license
depends=('gcc-libs' 'openmp')
makedepends=('gcc-fortran')
provides=('blas=3.8.0') # 3.9.0? Does the version even need to be set?
conflicts=('blas')
source=("${_pkgname}-v${pkgver}.tar.gz::https://github.com/xianyi/${_pkgname}/archive/v${pkgver}.tar.gz")
sha512sums=('86e7f496587cc35d7feede99cbe3cf627ef690dd7489bb03b95f7d15ed758e32baf17d79f17b1de187184394233f60a8249a64dd53c3d59a9540db92269b7ee4')

prepare() {
    # Change Directory
    cd "$srcdir"/$_pkgname-$pkgver

    # Wipe 32-Bit ARM Makefile Contents
    truncate -s 0 Makefile.arm # See 'ALARM'.

    # Manually Set CONFIG Target & Opts
    if [ $CARCH = arm ]; then
        _CONFIG='TARGET=ARMV5'
    elif [ $CARCH = armv6h ]; then
        _CONFIG='TARGET=ARMV6'
    elif [ $CARCH = armv7h ]; then
        _CONFIG='TARGET=ARMV7'
        CFLAGS=`echo $CFLAGS | sed 's/vfpv3-d16/neon/'` # See 'ALARM'.
        CXXFLAGS="$CFLAGS" # See 'ALARM'. Used?
    elif [ $CARCH = aarch64 ]; then
        _CONFIG='TARGET=ARMV8 DYNAMIC_ARCH=1'
    else
        echo 'CPU architecture not supported'
        exit 1
    fi
}

build() {
    # Change Directory
    cd "$srcdir"/$_pkgname-$pkgver

    # Build Libs
    make \
    NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_CBLAS=1 NO_AFFINITY=1 USE_OPENMP=1 \
    CFLAGS="$CPPFLAGS $CFLAGS" $_CONFIG \
    NUM_THREADS=64 MAJOR_VERSION=3 \
    libs shared
}

package() {
    # Change Directory
    cd "$srcdir"/$_pkgname-$pkgver

    # Install
    make install \
    PREFIX="$pkgdir"/usr

    # Remove Crud
    rm -f "$pkgdir"/usr/include/cblas.h "$pkgdir"/usr/include/lapack*
    rmdir "$pkgdir"/usr/bin

    # Install License
    install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
   
    # Change Directory
    cd "$pkgdir"/usr/lib
   
    # Fix File Naming
    find . -maxdepth 1 -type f -name 'libopenblas*.so*' -exec mv {} libopenblas.so.${pkgver} \;
    find . -maxdepth 1 -type f -name 'libopenblas*.a' -exec mv {} libopenblas.${pkgver}.a \;
   
    # Relink Symlinks
    find . -maxdepth 1 -type l -name 'lib*.so*' -delete
    ln -frs libopenblas.${pkgver}.a libopenblas.a
    for LIB in libblas.so libblas.so.3 libopenblas.so libopenblas.so.3
    do
        ln -frs libopenblas.so.${pkgver} $LIB
    done
   
    # Mod Ancillary Files
    ln -rs "$pkgdir"/usr/lib/pkgconfig/openblas.pc "$pkgdir"/usr/lib/pkgconfig/blas.pc
    sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/pkgconfig/openblas.pc
    sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/cmake/openblas/OpenBLASConfig.cmake
}

# vim:set ts=2 sw=2 et:



Looking over the PKGBUILD, I also have a few queries:

  • - Is 'CXXFLAGS' being referenced in any way on armv7h? I've left the code in there, just in case.
  • - Should the 'provides' array not reference the latest version of blas (3.9.0)?
Last edited by Feakster on Wed Jan 27, 2021 10:15 pm, edited 4 times in total.
Feakster
 
Posts: 7
Joined: Wed Nov 11, 2020 9:49 am

Re: Issues with the latest versions of openblas (0.3.13-1+)

Postby Feakster » Sat Jan 23, 2021 10:24 pm

Well... Having done a brief R test of the dynamic vs generic ARMv8 versions, it appears as though the dynamic one is either identical in performance to the generic ARMv8 one or very marginally worse. I'm not quite sure what to interpret from this. Maybe there are no meaningful optimisations for the ARM cortices in my machine (A72/A53)?
Last edited by Feakster on Tue Jan 26, 2021 10:02 am, edited 2 times in total.
Feakster
 
Posts: 7
Joined: Wed Nov 11, 2020 9:49 am

Re: Issues with the latest versions of openblas (0.3.13-1+)

Postby Feakster » Tue Jan 26, 2021 12:30 am

I've spent some more time on the PKGBUILD today in order to make the names of the outputs in the $pkgdir/usr/lib/ directory more in keeping with what you would expect (i.e. version numbers in the right place), and more consistent across ARM architectures (i.e. no build target names shoved in the middle of the library names). Below is the output of 'tree' in ./pkg:

Code: Select all
.
└── openblas
    └── usr
        ├── include
        │   ├── f77blas.h
        │   └── openblas_config.h
        ├── lib
        │   ├── cmake
        │   │   └── openblas
        │   │       ├── OpenBLASConfig.cmake
        │   │       └── OpenBLASConfigVersion.cmake
        │   ├── libblas.so -> libopenblas.so.0.3.13
        │   ├── libblas.so.3 -> libopenblas.so.0.3.13
        │   ├── libopenblas.0.3.13.a
        │   ├── libopenblas.so -> libopenblas.so.0.3.13
        │   ├── libopenblas.so.0.3.13
        │   ├── libopenblas.so.3 -> libopenblas.so.0.3.13
        │   └── pkgconfig
        │       ├── blas.pc -> openblas.pc
        │       └── openblas.pc
        └── share
            └── licenses
                └── openblas
                    └── LICENSE

10 directories, 13 files


All feedback welcome.
Feakster
 
Posts: 7
Joined: Wed Nov 11, 2020 9:49 am

Re: Issues with the latest versions of openblas (0.3.13-1+)

Postby archisman » Fri Feb 19, 2021 10:24 am

I encountered the same issue in GNU Octave with Openblas 0.3.13-2, in both a Raspberry Pi 2 (armv7) and Arch running inside Termux with proot in an Android phone (armv8).

Did anyone find a fix other than downgrading?
archisman
 
Posts: 3
Joined: Wed Feb 17, 2021 3:51 am

Re: Issues with the latest versions of openblas (0.3.13-1+)

Postby archisman » Sat Feb 20, 2021 6:45 am

I found this solution in the Manjaro Forums, and I verified that it also works on Arch. https://forum.manjaro.org/t/arm-stable-update-2020-12-30-python-3-9-rebuilds-kernels-firefox-mesa-20-2-6-kde-apps-gstreamer-kde-frameworks-libreoffice-thunderbird-pamac/45384/33?u=archisman

One has to symlink libopenblas.so.3 with libblas.so.3 (which did not exist before symlinking)

Code: Select all
sudo ln -s /usr/lib/libopenblas.so.3 /usr/lib/libblas.so.3
archisman
 
Posts: 3
Joined: Wed Feb 17, 2021 3:51 am


Return to Packages

Who is online

Users browsing this forum: No registered users and 1 guest