diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2021-03-21 17:45:23 +0100 |
---|---|---|
committer | Ralf Gommers <ralf.gommers@gmail.com> | 2021-03-21 17:45:23 +0100 |
commit | 6115fc52703baf07d4cfc629efb58866f0d16856 (patch) | |
tree | 71cab163d75f3a638fe3bcb9fcf16215cd29a2d4 | |
parent | 28ff24e264ec0e264c69e944a2c0aa48af9d27fa (diff) | |
download | numpy-6115fc52703baf07d4cfc629efb58866f0d16856.tar.gz |
BLD: remove /usr/include from default include dirs
Including this directory is painful for cross-compiling, see
gh-14980 and gh-13280. Removing this directory fixes the following
build failure:
```
gcc: numpy/core/src/common/numpyos.c
In file included from numpy/core/src/common/numpyos.c:23:
/usr/include/xlocale.h:27:16: error: redefinition of ‘struct __locale_struct’
27 | typedef struct __locale_struct
```
This error also shows up in various other build issues outside of the
NumPy issue tracker.
Compilers normally always include this path, so this shouldn't break
anything. The default include paths for the compiler can be checked,
e.g. for gcc with `cpp -v`. That will typically have /usr/include last.
In case this breaks something for a nonstandard compiler, that can be
worked around via a site.cfg file in the root of the repo (or
equivalently, `~/numpy-site.cfg`) containing:
```
[DEFAULT]
include_dirs = /usr/include
```
The same principle should apply to `/usr/lib`. I will make that change
in a separate commit, because the failure mode for that will be
different (and I'm not running into it right now).
-rw-r--r-- | numpy/distutils/system_info.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 2e355a34a..ae6f83e12 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -314,7 +314,7 @@ else: '/opt/local/lib', '/sw/lib'], platform_bits) default_runtime_dirs = [] default_include_dirs = ['/usr/local/include', - '/opt/include', '/usr/include', + '/opt/include', # path of umfpack under macports '/opt/local/include/ufsparse', '/opt/local/include', '/sw/include', @@ -323,8 +323,7 @@ else: default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib', '/usr/lib'], platform_bits) - default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include', - '/usr/include'] + default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include'] if os.path.exists('/usr/lib/X11'): globbed_x11_dir = glob('/usr/lib/*/libX11.so') |