Skip to content

numpy-1.19.4 import numpy Segmentation fault #17834

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

Closed
leidemon opened this issue Nov 24, 2020 · 4 comments
Closed

numpy-1.19.4 import numpy Segmentation fault #17834

leidemon opened this issue Nov 24, 2020 · 4 comments

Comments

@leidemon
Copy link

leidemon commented Nov 24, 2020

I use python3.8.4 and Cython-0.29.21, numpy-1.19.4 to test on mips platform;
when I cross compile over,and run "import numpy" it crashed,
Python 3.8.4 (default, Nov 24 2020, 10:53:37)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.

import numpy
/tmp/sda1/Python3/lib/python3.8/site-packages/numpy/core/_multiarray_umath.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import sys, pkg_resources, imp
Segmentation fault (core dumped)

waiting for reply,thank you

Reproducing code example:

import numpy as np
<< your code here >>

Error message:

GNU gdb (GDB) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mipsel-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3.8...(no debugging symbols found)...done.
[New LWP 25289]

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Core was generated by `python3.8'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x2c5155a4 in PyInit__multiarray_umath ()
at numpy/core/src/multiarray/multiarraymodule.c:4370
#2 0x2ba0e0dc in _PyImport_LoadDynamicModuleWithSpec ()
from /tmp/sda1/Python3/lib/libpython3.8d.so.1.0
Backtrace stopped: frame did not save the PC

NumPy/Python version information:

numpy 1.19.4 python 3.8.4 mips playform kernel 2.6.36+

@leidemon
Copy link
Author

leidemon commented Nov 25, 2020

update
I change the include file to cross compile,but it still crash;
gdb info :
GNU gdb (GDB) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mipsel-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3.8...(no debugging symbols found)...done.
[New LWP 19368]

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Core was generated by `python3.8'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x2baaa604 in PyUFunc_GenericFunction_int (ufunc=0x2be7d458,
args=0x2b7d9de0, kwds=0x0, op=0x7fb61790)
at numpy/core/src/umath/ufunc_object.c:3219
#2 0x2baabc30 in ufunc_generic_call (ufunc=0x2be7d458, args=0x2b7d9de0,
kwds=0x0) at numpy/core/src/umath/ufunc_object.c:4701
#3 0x2abe3884 in _PyObject_MakeTpCall ()
from /tmp/sda1/Python3/lib/libpython3.8d.so.1.0
Backtrace stopped: frame did not save the PC

@charris @teoliphant @cournape
if the code enter this condition with UCLIBC, it do not have the npy_clear_floatstatus_barrier and npy_get_floatstatus_barrier?
how to solve it?
684 #elif defined(_MSC_VER) || (defined(osf) && defined(__alpha)) ||
685 defined (UCLIBC) || (defined(arc) && defined(GLIBC))

@leidemon
Copy link
Author

leidemon commented Dec 9, 2020

I am sorry, I close the #17858 by mistake, so I update in this issue, they are the same issue.
now,
If it enters that condition, the definition on line 748 should be compiled. What does this print for you (after building)? Note you can format the pasted code as "code" by selecting it with the mouse and clicking the "< >" tool in the toolbar.

$objdump -T $(find build -name ieee754.o) | grep barrier
0000000000000380 g     F .text	0000000000000038 npy_get_floatstatus_barrier
0000000000000410 g     F .text	0000000000000030 npy_clear_floatstatus_barrier

about this ,I have tested.

objdump -T $(find build -name ieee754.o) | grep barrier
objdump: build/temp.linux-i686-3.8/build/src.linux-i686-3.8/numpy/core/src/npymath/ieee754.o: not a dynamic object

but I have confuse about _MSC_VER, is not it used for Windows?
@mattip

@mattip
Copy link
Member

mattip commented Dec 9, 2020

This is not the same issue. This one is a segfault, the other failed to load the shared object:

/tmp/sda1/Python3/bin/python3.8: symbol 'npy_clear_floatstatus_barrier': can't resolve symbol

Yes, _MSC_VER is only defined for windows.

I have reopened the other issue.

@seberg
Copy link
Member

seberg commented May 9, 2022

Considering that this is 2 years old and probably related to gh-17858 which was closed. I hope this was solved (e.g. with crossenv refered to in the other issue). If similar problems persist, we should open a new issue for a newer NumPy version.

@seberg seberg closed this as completed May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants