Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix detection of math library in numpy build #3520

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions easybuild/easyblocks/n/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ def get_libs_for_mkl(varname):
'includes': includes,
}

if LooseVersion(self.version) < LooseVersion('1.26'):
# NumPy detects the required math by trying to link a minimal code containing a call to `log(0.)`.
# The first try is without any libraries, which works with `gcc -fno-math-errno` (our optimization default)
# because the call gets removed due to not having any effect. So it concludes that `-lm` is not required.
# This then fails to detect availability of functions such as `acosh` which do not get removed in the same
# way and so less exact replacements are used instead which e.g. fail the tests on PPC.
# This variable makes it try `-lm` first and is supported until the Meson backend is used in 1.26+.
env.setvar('MATHLIB', 'm')

super(EB_numpy, self).configure_step()

if LooseVersion(self.version) < LooseVersion('1.21'):
Expand Down