Skip to content

Commit

Permalink
package/openblas: fix some x86 32bit builds
Browse files Browse the repository at this point in the history
OpenBLAS Makefile normally needs to explicitly define the CPU
architecture size (32 or 64bit) in the BINARY macro. See [1].

When an architecture supports both 64 and 32bit, the 32bit support
is sometimes implemented in OpenBLAS by overriding a fallback to an
anterior architecture. For example, if the build target architecture
is x86 Haswell 32bit, OpenBLAS build will override the arch to
Nehalem. See [2].

If the BINARY macro is undefined, the 32bit fallback will not happen,
sometimes leading to a link failure, with output:

    i686-buildroot-linux-gnu/bin/ar: strmm_kernel_LN.o: No such file or directory

This commit fixes those issues by explicitly defining the BINARY
macro. This issue has also been discussed upstream in [3] and [4].

Note: this issue was not introduced recently ([3] dates back from 2015),
and was also see in previous package version, for example in [5].

Fixes:
http://autobuild.buildroot.net/results/e1e/e1e2034a78799abe1bd28b036fa6f7d13322e42f

[1] https://github.com/xianyi/OpenBLAS/blob/v0.3.24/Makefile.rule#L50
[2] https://github.com/xianyi/OpenBLAS/blob/v0.3.24/Makefile.system#L113
[3] OpenMathLib/OpenBLAS#657
[4] OpenMathLib/OpenBLAS#1106
[5] http://autobuild.buildroot.net/results/5cd/5cdccd106b1de275ac75c39783e536107a31651f

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit eb4f5a2)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  • Loading branch information
jolivain authored and jacmet committed Sep 24, 2023
1 parent 8dd87af commit 500723f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions package/openblas/openblas.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ ifeq ($(BR2_STATIC_LIBS),y)
OPENBLAS_MAKE_OPTS += NO_SHARED=1
endif

ifeq ($(BR2_ARCH_IS_64),y)
OPENBLAS_MAKE_OPTS += BINARY=64
else
OPENBLAS_MAKE_OPTS += BINARY=32
endif

# binutils version <= 2.23.2 has a bug
# (https://sourceware.org/bugzilla/show_bug.cgi?id=14887) where
# whitespaces in ARM register specifications such as [ r1, #12 ] or [
Expand Down

0 comments on commit 500723f

Please sign in to comment.