Control: tags -1 patch fixed-upstream On Sat, Dec 26, 2020 at 10:45:50PM +0100, Lucas Nussbaum wrote: > Source: swiglpk > Version: 4.65.0-2 > Severity: serious > Justification: FTBFS on amd64 > Tags: bullseye sid ftbfs > Usertags: ftbfs-20201226 ftbfs-bullseye >... > > ====================================================================== > > ERROR: Failure: ImportError > > (/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_swiglpk/build/swiglpk/_swiglpk.cpython-39-x86_64-linux-gnu.so: > > undefined symbol: glp_netgen_prob) > > ---------------------------------------------------------------------- > > Traceback (most recent call last): > > File "/usr/lib/python3/dist-packages/nose/failure.py", line 39, in runTest > > raise self.exc_val.with_traceback(self.tb) > > File "/usr/lib/python3/dist-packages/nose/loader.py", line 416, in > > loadTestsFromName > > module = self.importer.importFromPath( > > File "/usr/lib/python3/dist-packages/nose/importer.py", line 47, in > > importFromPath > > return self.importFromDir(dir_path, fqname) > > File "/usr/lib/python3/dist-packages/nose/importer.py", line 94, in > > importFromDir > > mod = load_module(part_fqname, fh, filename, desc) > > File "/usr/lib/python3.9/imp.py", line 244, in load_module > > return load_package(name, filename) > > File "/usr/lib/python3.9/imp.py", line 216, in load_package > > return _load(spec) > > File "<frozen importlib._bootstrap>", line 711, in _load > > File "<frozen importlib._bootstrap>", line 680, in _load_unlocked > > File "<frozen importlib._bootstrap_external>", line 790, in exec_module > > File "<frozen importlib._bootstrap>", line 228, in > > _call_with_frames_removed > > File > > "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_swiglpk/build/swiglpk/__init__.py", > > line 1, in <module> > > from .swiglpk import * > > File > > "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_swiglpk/build/swiglpk/swiglpk.py", > > line 13, in <module> > > from . import _swiglpk > > ImportError: > > /<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_swiglpk/build/swiglpk/_swiglpk.cpython-39-x86_64-linux-gnu.so: > > undefined symbol: glp_netgen_prob > > > > ---------------------------------------------------------------------- >...
Attached are the relevant parts from the upstream fix. After that, it is worth trying whether this fixed python-cobra. cu Adrian
>From ec985c15ae507139de70b943c56f1042acd79a8a Mon Sep 17 00:00:00 2001 From: Jonathon Fletcher <jonathon.fletc...@gmail.com> Date: Tue, 2 Feb 2021 00:56:27 -0800 Subject: ignore problematic functions via swig directives in glpk.i (#43) diff --git a/scripts/find_newest_glpk_release.py b/scripts/find_newest_glpk_release.py index bf79f74..e4254df 100755 --- a/scripts/find_newest_glpk_release.py +++ b/scripts/find_newest_glpk_release.py @@ -12,7 +12,8 @@ if response.ok: new_major, new_minor = int(match[0][0]), int(match[0][1]) if new_major > major: major = new_major - if new_minor > minor: + minor = new_minor + if new_major >= major and new_minor > minor: minor = new_minor print('{}.{}'.format(major, minor), end='') diff --git a/setup.py b/setup.py index fbf76a1..e8d81b1 100644 --- a/setup.py +++ b/setup.py @@ -22,39 +22,38 @@ from distutils.command.build import build import subprocess import versioneer -def copy_glpk_header(): - if os.path.isfile('glpk.h'): + +def find_glpk_header(): + if os.environ.get("GLPK_HEADER_PATH", None) and os.path.isdir(os.environ.get("GLPK_HEADER_PATH", None)): + print('glpk.h found in GLPK_HEADER_PATH environment variable') + glpk_header_path = os.path.join(os.environ.get("GLPK_HEADER_PATH", None), 'glpk.h') + elif os.path.isfile('glpk.h'): print('glpk.h found in source directory') - glpk_header_path = os.path.join('./', 'glpk.h') + glpk_header_path = os.path.join(os.getcwd(), 'glpk.h') else: print('Trying to determine glpk.h location') - glpsol_path = os.path.dirname(subprocess.check_output(['which', 'glpsol'])) - glpk_header_path = os.path.join(os.path.dirname(glpsol_path).decode("utf-8"), 'include', 'glpk.h') - print('glpk.h found at {}'.format(glpk_header_path)) + glpsol_dirname = os.path.dirname(subprocess.check_output(['which', 'glpsol'])) + glpk_header_path = os.path.join(os.path.dirname(glpsol_dirname).decode("utf-8"), 'include', 'glpk.h') if os.path.exists(glpk_header_path): - with open('swiglpk/glpk_clean.h', 'w') as out_handle: - with open(glpk_header_path) as in_handle: - for line in in_handle: - if line == 'void glp_vprintf(const char *fmt, va_list arg);\n': - out_handle.write('// The following line is commented out because it is causing problems with swig\n') - out_handle.write('// void glp_vprintf(const char *fmt, va_list arg);') - else: - out_handle.write(line) + print('glpk.h found at {}'.format(glpk_header_path)) + return os.path.dirname(os.path.abspath(glpk_header_path)) else: raise Exception('Could not find glpk.h! Maybe glpk or glpsol is not installed.') + try: with open('README.rst', 'r') as f: long_description = f.read() -except: +except Exception: long_description = '' -# Copy and process glpk.h into current directory -copy_glpk_header() +glpk_header_dirname = find_glpk_header() + custom_cmd_class = versioneer.get_cmdclass() + class CustomBuild(build): sub_commands = [ ('build_ext', build.has_ext_modules), @@ -63,6 +62,7 @@ class CustomBuild(build): ('build_scripts', build.has_scripts), ] + custom_cmd_class['build'] = CustomBuild try: @@ -102,6 +102,8 @@ setup( ], ext_modules=[Extension("swiglpk._swiglpk", sources=["swiglpk/glpk.i"], + include_dirs=[glpk_header_dirname], + swig_opts=["-I"+glpk_header_dirname], libraries=['glpk'])], include_package_data=True ) diff --git a/swiglpk/__init__.py b/swiglpk/__init__.py index 3b10d42..5bc73ae 100644 --- a/swiglpk/__init__.py +++ b/swiglpk/__init__.py @@ -1 +1 @@ -from .swiglpk import * \ No newline at end of file +from .swiglpk import * diff --git a/swiglpk/glpk.i b/swiglpk/glpk.i index 0ede927..ade8fbb 100644 --- a/swiglpk/glpk.i +++ b/swiglpk/glpk.i @@ -16,11 +16,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +%ignore glp_vprintf; +%ignore glp_netgen_prob; + %module swiglpk %{ #define SWIG_FILE_WITH_INIT -#include "./glpk_clean.h" +#include "glpk.h" int wrap_glp_term_hook_cb(void *info, const char *s) { @@ -61,7 +64,7 @@ PyObject *wrap_glp_term_hook(PyObject *callback) } %} -%include glpk_clean.h +%include glpk.h %include "carrays.i" %array_class(int, intArray);