Source: scipy
Version: 1.10.0-2
Severity: normal
Tags: patch
X-Debbugs-Cc: g...@nonempty.org

Dear Maintainer,

Ever since #778635, the SciPy package has carried a patch that makes it
use the system LBFGSB library provided by liblbfgsb0 instead of the
bundled copy that upstream uses. It seems that this patch no longer does
the trick with SciPy's move to building with Meson, as has become
evident with 1.10.0-2 entering unstable:

 * python3-scipy no longer depends on liblbfgsb0
 * 
/usr/lib/python3/dist-packages/scipy/optimize/_lbfgsb.cpython-311-x86_64-linux-gnu.so
 has no reference to liblbfgsb.so.0

Attached is an updated patch, to replace the old one with the same name,
that seems to rectify the situation. I have tested that it restores
linking with liblbfgsb.so.0, and that no tests fail.


 Best,
 Gard
From: Gard Spreemann <g...@nonempty.org>
Date: Sun, 29 Jan 2023 19:55:15 +0100
Subject: Use system LBFGSB.

---
 scipy/optimize/meson.build | 5 +----
 scipy/optimize/setup.py    | 4 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/scipy/optimize/meson.build b/scipy/optimize/meson.build
index c7079e7..78a006f 100644
--- a/scipy/optimize/meson.build
+++ b/scipy/optimize/meson.build
@@ -100,15 +100,12 @@ lbfgsb_module = custom_target('lbfgsb_module',
 
 _lbfgsb = py3.extension_module('_lbfgsb',
   [
-    'lbfgsb_src/lbfgsb.f',
-    'lbfgsb_src/linpack.f',
-    'lbfgsb_src/timer.f',
     lbfgsb_module,
   ],
   c_args: numpy_nodepr_api,
   fortran_args: fortran_ignore_warnings,
   include_directories: [inc_np, inc_f2py],
-  link_args: version_link_args,
+  link_args: version_link_args + ['-llbfgsb'],
   dependencies: [lapack, fortranobject_dep],
   install: true,
   link_language: 'fortran',
diff --git a/scipy/optimize/setup.py b/scipy/optimize/setup.py
index c24ef50..1dabc2b 100644
--- a/scipy/optimize/setup.py
+++ b/scipy/optimize/setup.py
@@ -64,8 +64,10 @@ def configuration(parent_package='', top_path=None):
         pre_build_hook = None
 
     lapack = combine_dict(lapack, numpy_nodepr_api)
+    lapack.setdefault('libraries', [])
+    lapack['libraries'].append('lbfgsb')
 
-    sources = ['lbfgsb.pyf', 'lbfgsb.f', 'linpack.f', 'timer.f']
+    sources = ['lbfgsb.pyf']
     ext = config.add_extension('_lbfgsb',
                                sources=[join('lbfgsb_src', x)
                                         for x in sources],

Attachment: signature.asc
Description: PGP signature

Reply via email to