From f4738889bd34d294cfcbd4aaed8c914fe961a0fd Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Wed, 12 Oct 2022 07:40:27 +0200 Subject: [PATCH] BLD: fix issue with incomplete threads dependency handling (#17200) All could using `#include ` needs to have this `thread_dep` dependency. HiGHS code was missing it, and for `stats/_qmc_cy.pyx` it was incorrectly specified. It's wrong in the distutils build as well, but let's ignore that since it's much harder to change and we'll get rid of that build soon. See gh-17193 for the type of compile error this causes. [ci skip] --- scipy/fft/_pocketfft/meson.build | 8 ++------ scipy/meson.build | 2 ++ scipy/optimize/_highs/meson.build | 5 ++++- scipy/stats/meson.build | 4 +--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/scipy/fft/_pocketfft/meson.build b/scipy/fft/_pocketfft/meson.build index 6015cf538dbc..76ac83caeeb6 100644 --- a/scipy/fft/_pocketfft/meson.build +++ b/scipy/fft/_pocketfft/meson.build @@ -1,12 +1,8 @@ -thread_dep = dependency('threads', required: false) - -# mingw-w64 does not implement pthread_pfork, needed by pocket_fft -win_gcc = is_windows and meson.get_compiler('cpp').get_id() == 'gcc' - pocketfft_threads = [] fft_deps = [py3_dep] if is_windows - if win_gcc + if is_mingw + # mingw-w64 does not implement pthread_pfork, needed by pocket_fft # Disable threading completely, because of freezes using threading for # mingw-w64 gcc: https://github.com/mreineck/pocketfft/issues/1 pocketfft_threads += ['-DPOCKETFFT_NO_MULTITHREADING'] diff --git a/scipy/meson.build b/scipy/meson.build index b59fb621e24e..7554397e3162 100644 --- a/scipy/meson.build +++ b/scipy/meson.build @@ -34,6 +34,8 @@ if is_windows endif endif +thread_dep = dependency('threads', required: false) + # NumPy include directory - needed in all submodules incdir_numpy = run_command(py3, [ diff --git a/scipy/optimize/_highs/meson.build b/scipy/optimize/_highs/meson.build index 26e78677ad40..d202efebca90 100644 --- a/scipy/optimize/_highs/meson.build +++ b/scipy/optimize/_highs/meson.build @@ -104,6 +104,7 @@ ipx_lib = static_library('ipx', '../../_lib/highs/extern/', 'cython/src/' ], + dependencies: thread_dep, cpp_args: [highs_flags, highs_define_macros] ) @@ -220,6 +221,7 @@ highs_lib = static_library('highs', '../../_lib/highs/src/lp_data/', '../../_lib/highs/src/util/', ], + dependencies: thread_dep, cpp_args: [highs_flags, highs_define_macros] ) @@ -234,6 +236,7 @@ _highs_wrapper = py3.extension_module('_highs_wrapper', '../../_lib/highs/src/lp_data/', '../../_lib/highs/src/util/' ], + dependencies: thread_dep, link_with: [highs_lib, ipx_lib, basiclu_lib], dependencies: [py3_dep], cpp_args: [highs_flags, highs_define_macros, cython_c_args], @@ -252,7 +255,7 @@ _highs_constants = py3.extension_module('_highs_constants', '../../_lib/highs/src/lp_data/', '../../_lib/highs/src/simplex/' ], - dependencies: [py3_dep], + dependencies: [py3_dep, thread_dep], install: true, subdir: 'scipy/optimize/_highs' ) diff --git a/scipy/stats/meson.build b/scipy/stats/meson.build index 2bc83919a097..dfac9e073b17 100644 --- a/scipy/stats/meson.build +++ b/scipy/stats/meson.build @@ -92,12 +92,10 @@ py3.install_sources([ subdir: 'scipy/stats' ) -pthread = dependency('threads') - _qmc_cy = py3.extension_module('_qmc_cy', cython_gen_cpp.process('_qmc_cy.pyx'), cpp_args: cython_cpp_args, - dependencies: [py3_dep, pthread], + dependencies: [py3_dep, thread_dep], include_directories: [inc_np], install: true, subdir: 'scipy/stats'