diff options
author | Masamichi Hosoda <trueroad@trueroad.jp> | 2022-01-23 11:37:29 +0900 |
---|---|---|
committer | Masamichi Hosoda <trueroad@trueroad.jp> | 2022-01-23 17:45:26 +0900 |
commit | d88a07e46e39c8f9c13cca6b6b0e18b9350162dc (patch) | |
tree | 53e5daeed577a68a8b2cab9c35b6f2459592e064 /numpy/random | |
parent | 37f3d19b5c196111f3a37ff81503cebf0199b638 (diff) | |
download | numpy-d88a07e46e39c8f9c13cca6b6b0e18b9350162dc.tar.gz |
BUG: Fix CI failure by adding symbols to be exported on Cygwin
There are two types of Cython in the Cygwin environment.
One is a Cygwin package's Cython,
which does not add a `__declspec(dllexport)` attribute to symbols
due to its custom patch.
The other is Cython, which is installed with pip and has no custom patches,
so the symbols are added the `__declspec(dllexport)` attribute.
Since CI uses symbols in distributions.c by cffi, we need to export them.
The commit b797a0cb97a8a9e7e36962dc8c37c075967aa88b exports the symbols
by adding the `__declspec(dllexport)` attribute to them.
However, in the Cygwin package's Cython environment,
the symbols required for import are not exported
and the module cannot be imported.
https://cygwin.com/pipermail/cygwin/2022-January/250481.html
By the previous commit, the `__declspec(dllexport)` attribute is removed,
so in the environment, the required symbols are exported
and the module can be imported.
However, on the other hand, in the pip-installed Cython environment,
the symbols used by cffi are not exported, so CI failed.
This commit exports the symbols without `__declspec(dllexport)`
for use by cffi.
It exports both the symbols required for import
and the symbols used for cffi,
regardless of which Cython environment is used.
Diffstat (limited to 'numpy/random')
-rw-r--r-- | numpy/random/setup.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/random/setup.py b/numpy/random/setup.py index 866c0cb2f..01808e83c 100644 --- a/numpy/random/setup.py +++ b/numpy/random/setup.py @@ -50,6 +50,13 @@ def configuration(parent_package='', top_path=None): # Some bit generators require c99 EXTRA_COMPILE_ARGS += ['-std=c99'] + if sys.platform == 'cygwin': + # Export symbols without __declspec(dllexport) for using by cython. + # Using __declspec(dllexport) does not export other necessary symbols + # in Cygwin package's Cython enviroment, making it impossible to + # import modules. + EXTRA_LINK_ARGS += ['-Wl,--export-all-symbols'] + # Use legacy integer variable sizes LEGACY_DEFS = [('NP_RANDOM_LEGACY', '1')] PCG64_DEFS = [] |