tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

numpy failure on netbsd-9, rintl



As background, I am using numpy, not really intentionally, but because
homeassistant depends on it indirectly, as does gpsd via py-matplotlib.

I have a RPI3, netbsd-9, and pkgsrc 2023Q3.  Importing  numpy results
in the following error (full output at end):

  ImportError: /usr/pkg/lib/python3.11/site-packages/numpy/core/_multiarray_umath.so: Undefined PLT symbol "rintl" (symnum = 157)

In the sources, the definition is guarded by
  #ifdef __HAVE_LONG_DOUBLE

See src/lib/libm/src/s_rintl.c which seems to be the same 9/10/current.

I have previously accumulated some diffs in my sources to deal with this
kind of issue:

Index: s_frexp.c
===================================================================
RCS file: /cvsroot/src/lib/libm/src/s_frexp.c,v
retrieving revision 1.13
diff -u -p -r1.13 s_frexp.c
--- s_frexp.c	28 Sep 2008 18:54:55 -0000	1.13
+++ s_frexp.c	16 Nov 2023 13:59:37 -0000
@@ -31,6 +31,11 @@ __RCSID("$NetBSD: s_frexp.c,v 1.13 2008/
 static const double
 two54 =  1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
 
+#ifndef __HAVE_LONG_DOUBLE
+__strong_alias(_frexpl, frexp)
+__weak_alias(frexpl, _frexpl)
+#endif
+
 double
 frexp(double x, int *eptr)
 {


As I look at POSIX, which defers to C99, it seems that long double as a
type and long double function variants are required, even if long double
can be equal to double.

On arm, long double seems to be just double, and _HAVE_LONG_DOUBLE isn't
defined, leading to these symbols being missing from libm.   But they
are still in the headers.


I suspect that the right approach is to either systematicaly add the
above, or something similar, but I'm not adequately certain to commit vs
patch locally.

What do our floating point experts think?





-----------------------------------------
$ python3.11
Python 3.11.5 (main, Sep 30 2023, 19:59:56) [GCC 7.4.0] on netbsd9
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy;
Traceback (most recent call last):
File "/usr/pkg/lib/python3.11/site-packages/numpy/core/__init__.py", line 23, in <module>
from . import multiarray
File "/usr/pkg/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/usr/pkg/lib/python3.11/site-packages/numpy/core/overrides.py", line 8, in <module>
from numpy.core._multiarray_umath import (
ImportError: /usr/pkg/lib/python3.11/site-packages/numpy/core/_multiarray_umath.so: Undefined PLT symbol "rintl" (symnum = 157)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/pkg/lib/python3.11/site-packages/numpy/__init__.py", line 139, in <module>
from . import core
File "/usr/pkg/lib/python3.11/site-packages/numpy/core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

* The Python version is: Python3.11 from "/usr/pkg/bin/python3.11"
* The NumPy version is: "1.25.2"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: /usr/pkg/lib/python3.11/site-packages/numpy/core/_multiarray_umath.so: Undefined PLT symbol "rintl" (symnum = 157)


Home | Main Index | Thread Index | Old Index