Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 570b209

Browse files
authored
Merge pull request #24222 from seberg/fix-cblas-wheels
BUG: Fix cblas detection for the wheel builds
2 parents d9d1789 + 7427fb3 commit 570b209

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

numpy/meson.build

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ else
4848
endif
4949

5050

51+
# This is currently injected directly into CFLAGS/CXXFLAGS for wheel builds
52+
# (see cibuildwheel settings in pyproject.toml)
53+
blas_symbol_suffix = get_option('blas-symbol-suffix')
54+
55+
5156
# TODO: 64-bit BLAS and LAPACK
5257
#
5358
# Note that this works as long as BLAS and LAPACK are detected properly via
@@ -69,6 +74,14 @@ endif
6974
have_blas = blas.found()
7075
cblas = []
7176
if have_blas
77+
# As noted above, at this point the BLAS_SYMBOL_SUFFIX may be injected into
78+
# the CFLAGS directly, so this requires care to use that when it happens:
79+
if blas_symbol_suffix != ''
80+
probe_args = ['-DBLAS_SYMBOL_SUFFIX=' + blas_symbol_suffix]
81+
else
82+
probe_args = []
83+
endif
84+
7285
# Netlib BLAS has a separate `libcblas.so` which we use directly in the g77
7386
# ABI wrappers, so detect it and error out if we cannot find it. OpenBLAS can
7487
# be built without CBLAS too (see gh-23909, done by Arch Linux until
@@ -78,15 +91,22 @@ if have_blas
7891
# see https://github.com/mesonbuild/meson/pull/10921.
7992
have_cblas = false
8093
if cc.links('''
94+
#ifndef BLAS_SYMBOL_SUFFIX
95+
# define BLAS_SYMBOL_SUFFIX
96+
#endif
97+
#define EXPAND(suffix) cblas_ddot ## suffix
98+
#define DDOT(suffix) EXPAND(suffix)
99+
81100
#include <cblas.h>
82101
int main(int argc, const char *argv[])
83102
{
84103
double a[4] = {1,2,3,4};
85104
double b[4] = {5,6,7,8};
86-
return cblas_ddot(4, a, 1, b, 1) > 10;
105+
return DDOT(BLAS_SYMBOL_SUFFIX)(4, a, 1, b, 1) > 10;
87106
}
88107
''',
89108
dependencies: blas,
109+
args: probe_args,
90110
name: 'CBLAS',
91111
)
92112
have_cblas = true
@@ -133,9 +153,6 @@ if have_blas
133153
if use_ilp64
134154
c_args_blas += ['-DHAVE_BLAS_ILP64']
135155
endif
136-
# This is currently injected directly into CFLAGS/CXXFLAGS for wheel builds
137-
# (see cibuildwheel settings in pyproject.toml)
138-
blas_symbol_suffix = get_option('blas-symbol-suffix')
139156
if blas_symbol_suffix != ''
140157
c_args_blas += ['-DBLAS_SYMBOL_SUFFIX=' + blas_symbol_suffix]
141158
endif

0 commit comments

Comments
 (0)