Skip to content

TestF77Callback::test_all[t] fails: fatal error: threads.h: No such file or directory #18179

@pearu

Description

@pearu

Reproducing code example:

pytest -sv numpy/f2py/tests/test_callback.py -k 'test_all[t]' -r s -x

Error message:

E                                  /tmp/tmphz3v9phb/src.linux-x86_64-3.9/_test_ext_module_5403module.c:75:10: fatal error: threads.h: No such file or directory
E                                     75 | #include <threads.h>
E                                        |          ^~~~~~~~~~~
E                                  compilation terminated.

NumPy/Python version information:

>>> import sys, numpy; print(numpy.__version__, sys.version)
1.21.0.dev0+438.gbf4ac1f81 3.9.1 | packaged by conda-forge | (default, Jan 10 2021, 02:55:42) 
[GCC 9.3.0]

Additional information

$ ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1.2) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.

C11 threads.h appears to be supported starting from glibc 2.28, see here.

Undefining CPP macro F2PY_THREAD_LOCAL_DECL makes the test pass.

A solution is not to define F2PY_THREAD_LOCAL_DECL for glibc version < 2.28 in numpy/f2py/cfuncs.py .

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions