Skip to content

Conversation

dimpase
Copy link
Member

@dimpase dimpase commented Oct 3, 2025

unbreak building of sage_numerical_backends_coin and along the way fix #40726

Does not break the infamous src/sage/env.py test, and does not (yet) remove sage_conf package.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@dimpase
Copy link
Member Author

dimpase commented Oct 3, 2025

at the moment the upstream package file is just a temporary file, but I'll make a proper one.

I propose stop linking the version of this package and the Sage version.

@dimpase dimpase mentioned this pull request Oct 3, 2025
5 tasks
Copy link

github-actions bot commented Oct 3, 2025

Documentation preview for this PR (built with commit f8a01d1; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@dcoudert
Copy link
Contributor

dcoudert commented Oct 3, 2025

What's the right way to test this PR ?

I tried this and it fails

MAC-04017247:sage dcoudert$ ./sage -pip install sage-numerical-backends-coin
Collecting sage-numerical-backends-coin
  Using cached sage_numerical_backends_coin-10.4.tar.gz (23 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [101 lines of output]
      Collecting setuptools>=68.1.1
        Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
      Collecting pkgconfig
        Using cached pkgconfig-1.5.5-py3-none-any.whl.metadata (4.0 kB)
      Collecting cython!=3.0.3,<4.0,>=3.0
        Using cached cython-3.1.4-cp312-cp312-macosx_11_0_arm64.whl.metadata (5.0 kB)
      Collecting cysignals>=1.10.2
        Using cached cysignals-1.12.5-cp312-cp312-macosx_11_0_arm64.whl.metadata (12 kB)
      Collecting sagemath-environment
        Using cached sagemath_environment-10.7-py3-none-any.whl.metadata (3.1 kB)
      Collecting sagemath-categories
        Using cached sagemath_categories-10.7.tar.gz (563 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'error'
        error: subprocess-exited-with-error
      
        × pip subprocess to install build dependencies did not run successfully.
        │ exit code: 1
        ╰─> [72 lines of output]
            Collecting setuptools>=68.1.1
              Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
            Collecting wheel>=0.36.2
              Using cached wheel-0.45.1-py3-none-any.whl.metadata (2.3 kB)
            Collecting sage-setup~=10.7
              Using cached sage_setup-10.7-py3-none-any.whl.metadata (1.3 kB)
            Collecting sagemath-environment~=10.7
              Using cached sagemath_environment-10.7-py3-none-any.whl.metadata (3.1 kB)
            Collecting sagemath-objects~=10.7
              Using cached sagemath_objects-10.7.tar.gz (667 kB)
              Installing build dependencies: started
              Installing build dependencies: finished with status 'done'
              Getting requirements to build wheel: started
              Getting requirements to build wheel: finished with status 'error'
              error: subprocess-exited-with-error
      
              × Getting requirements to build wheel did not run successfully.
              │ exit code: 1
              ╰─> [43 lines of output]
                  Traceback (most recent call last):
                    File "/opt/homebrew/bin/meson", line 3, in <module>
                      from mesonbuild.mesonmain import main
                  ModuleNotFoundError: No module named 'mesonbuild'
                  ninja: error: rebuilding 'build.ninja': subcommand failed
                  ************************************************************************
                  Traceback (most recent call last):
                    File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/_sagemath_editable_loader.py", line 345, in _rebuild
                      subprocess.run(self._build_cmd, cwd=self._build_path, env=env, stdout=subprocess.DEVNULL, check=True)
                    File "/opt/homebrew/Cellar/[email protected]/3.12.11/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 571, in run
                      raise CalledProcessError(retcode, process.args,
                  subprocess.CalledProcessError: Command '['/opt/homebrew/bin/ninja']' returned non-zero exit status 1.
      
                  The above exception was the direct cause of the following exception:
      
                  Traceback (most recent call last):
                    File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
                      main()
                    File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
                      json_out['return_val'] = hook(**hook_input['kwargs'])
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
                      return hook(config_settings)
                             ^^^^^^^^^^^^^^^^^^^^^
                    File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-c6z4uktl/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel
                      return self._get_build_requires(config_settings, requirements=[])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-c6z4uktl/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
                      self.run_setup()
                    File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-c6z4uktl/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in run_setup
                      exec(code, locals())
                    File "<string>", line 21, in <module>
                    File "/private/var/folders/hw/w6ldqpgn52vdvv03cgbkkr3h3lhtdp/T/pip-build-env-c6z4uktl/overlay/lib/python3.12/site-packages/sage_setup/setenv.py", line 17, in setenv
                      from sage.env import SAGE_LOCAL, SAGE_VENV, SAGE_ARCHFLAGS, SAGE_PKG_CONFIG_PATH
                    File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/_sagemath_editable_loader.py", line 311, in find_spec
                      tree = self._rebuild()
                             ^^^^^^^^^^^^^^^
                    File "/Users/dcoudert/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/_sagemath_editable_loader.py", line 347, in _rebuild
                      raise ImportError(f're-building the {self._name} meson-python editable wheel package failed') from exc
                  ImportError: re-building the sagemath meson-python editable wheel package failed
                  ************************************************************************
                  Error building the Sage library
                  ************************************************************************
                  [end of output]
      
              note: This error originates from a subprocess, and is likely not a problem with pip.
            error: subprocess-exited-with-error
      
            × Getting requirements to build wheel did not run successfully.
            │ exit code: 1
            ╰─> See above for output.
      
            note: This error originates from a subprocess, and is likely not a problem with pip.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error
      
      × pip subprocess to install build dependencies did not run successfully.
      │ exit code: 1
      ╰─> See above for output.
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

@dimpase
Copy link
Member Author

dimpase commented Oct 3, 2025

no, just think of it as an optional spkg.

Look up the configure option to use to enable it, run ./configure with this option, then make, etc.

@dcoudert
Copy link
Contributor

dcoudert commented Oct 3, 2025

I can't compile cbc 2.9.4.p0. homebrew version is 2.10.12.

[cbc-2.9.4.p0] [spkg-install] g++ -std=gnu++11 -dynamiclib -single_module  -o .libs/libClp.1.13.6.dylib .libs/libClp.1.13.6.dylib-master.o  -L/Users/dcoudert/sage/local/lib -lreadline -lncurses -L/opt/homebrew/Cellar/coinutils/2.11.12/lib -lCoinUtils -lbz2 -lz -L/opt/homebrew/opt/openblas/lib -lopenblas -lm  -install_name  /Users/dcoudert/sage/local/lib/libClp.1.dylib -compatibility_version 15 -current_version 15.6
[cbc-2.9.4.p0] [spkg-install] ld: warning: -single_module is obsolete
[cbc-2.9.4.p0] [spkg-install] Undefined symbols for architecture arm64:
[cbc-2.9.4.p0] [spkg-install]   "CoinIndexedVector::checkClear()", referenced from:
[cbc-2.9.4.p0] [spkg-install]       ClpDualRowSteepest::updateWeights(CoinIndexedVector*, CoinIndexedVector*, CoinIndexedVector*, CoinIndexedVector*) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpDualRowSteepest::updateWeights(CoinIndexedVector*, CoinIndexedVector*, CoinIndexedVector*, CoinIndexedVector*) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpFactorization::updateColumnForDebug(CoinIndexedVector*, CoinIndexedVector*, bool) const in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpSimplex::createRim(int, bool, int) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpSimplex::createRim(int, bool, int) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpSimplex::createRim(int, bool, int) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpSimplex::createRim(int, bool, int) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpSimplex::createRim(int, bool, int) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ClpSimplex::createRim(int, bool, int) in libClp.1.13.6.dylib-master.o
[cbc-2.9.4.p0] [spkg-install]       ...
[cbc-2.9.4.p0] [spkg-install] ld: symbol(s) not found for architecture arm64
[cbc-2.9.4.p0] [spkg-install] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[cbc-2.9.4.p0] [spkg-install] make[6]: *** [libClp.la] Error 1
[cbc-2.9.4.p0] [spkg-install] make[5]: *** [all] Error 2
[cbc-2.9.4.p0] [spkg-install] make[4]: *** [all-recursive] Error 1
[cbc-2.9.4.p0] [spkg-install] make[3]: *** [all-recursive] Error 1
[cbc-2.9.4.p0] [spkg-install] ********************************************************************************
[cbc-2.9.4.p0] [spkg-install] Error building cbc-2.9.4.p0
[cbc-2.9.4.p0] [spkg-install] ********************************************************************************

@dimpase
Copy link
Member Author

dimpase commented Oct 3, 2025

I can't compile cbc 2.9.4.p0. homebrew version is 2.10.12.

does it work with with the Homebrew version?

[cbc-2.9.4.p0] [spkg-install] g++ -std=gnu++11 -dynamiclib -single_module  -o .libs/libClp.1.13.6.dylib .libs/libClp.1.13.6.dylib-master.o  -L/Users/dcoudert/sage/local/lib -lreadline -lncurses -L/opt/homebrew/Cellar/coinutils/2.11.12/lib -lCoinUtils -lbz2 -lz -L/opt/homebrew/opt/openblas/lib -lopenblas -lm  -install_name  /Users/dcoudert/sage/local/lib/libClp.1.dylib -compatibility_version 15 -current_version 15.6

either your LDFLAGS are unclean, or cbc's configure finds these coinutils thing which isn't compatible (something I've never seen)

cbc 2.10 has more dependencies, so bumping up the version isn't too easy.

@dcoudert
Copy link
Contributor

dcoudert commented Oct 4, 2025

configure with option --use-system-cbc=yes says

cbc:                            no suitable system package; optional, use "./configure --enable-cbc" to install SPKG version 2.9.4.p0

I tried with option -enable-cbc and then compilation of 2.9.4.p0 fails.

@dimpase
Copy link
Member Author

dimpase commented Oct 5, 2025

OK, I see - cbc depends on openblas, but Homebrew's openblas is incompatible with Sage, as it uses libgomp.dylib, and cannot be used with clang (not without extra hacks).

Namely:

 % pkg-config --cflags openblas
-I/opt/homebrew/Cellar/openblas/0.3.30/include -fopenmp

(and Apple clang doesn't grok -fopenmp, it needs -Xpreprocessor -fopenmp. But it's only part of the story. To use OpenMP with clang, it must be LLVM's OpenMP, not GNU OpenMP - and openblas uses the latter. So it's a mess)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

external cython packages broken in 10.8.beta1
2 participants