sage icon indicating copy to clipboard operation
sage copied to clipboard

cvxopt fails on arm macos: no LC_RPATH's found

Open vbraun opened this issue 1 year ago • 5 comments

Steps To Reproduce

Build sage from source, with as few external depedencies as possible

Expected Behavior

No crash ;-)

Actual Behavior

cvxopt does not set up rpaths, so any attempt at using it fails:

**********************************************************************
File "src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst", line 35, in doc.en.thematic_tutorials.numerical_sage.cvxopt
Failed example:
    from cvxopt import umfpack
Exception raised:
    Traceback (most recent call last):
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 714, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 1144, in compile_and_execute
        exec(compiled, globs)
      File "<doctest doc.en.thematic_tutorials.numerical_sage.cvxopt[3]>", line 1, in <module>
        from cvxopt import umfpack
    ImportError: dlopen(/Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/cvxopt/umfpack.cpython-312-darwin.so, 0x0002): Library not loaded: @rpath/libumfpack.6.dylib
      Referenced from: <0B34CA55-D3C1-34D6-9066-3F5A609B4A2D> /Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/cvxopt/umfpack.cpython-312-darwin.so
      Reason: no LC_RPATH's found
**********************************************************************
**********************************************************************
File "src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst", line 35, in doc.en.thematic_tutorials.numerical_sage.cvxopt
Failed example:
    from cvxopt import umfpack
Exception raised:
    Traceback (most recent call last):
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 714, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/buildbot-sage/worker/sage_git/build/src/sage/doctest/forker.py", line 1144, in compile_and_execute
        exec(compiled, globs)
      File "<doctest doc.en.thematic_tutorials.numerical_sage.cvxopt[3]>", line 1, in <module>
        from cvxopt import umfpack
    ImportError: dlopen(/Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/cvxopt/umfpack.cpython-312-darwin.so, 0x0002): Library not loaded: @rpath/libumfpack.6.dylib
      Referenced from: <0B34CA55-D3C1-34D6-9066-3F5A609B4A2D> /Users/buildbot-sage/worker/sage_git/build/local/var/lib/sage/venv-python3.12.5/lib/python3.12/site-packages/cvxopt/umfpack.cpython-312-darwin.so
      Reason: no LC_RPATH's found
**********************************************************************

Additional Information

No response

Environment

Mac mini M2

Checklist

  • [X] I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • [X] I have read the documentation and troubleshoot guide

vbraun avatar Oct 05 '24 09:10 vbraun

Upstream report?

dimpase avatar Oct 07 '24 12:10 dimpase

With admittedly many Homebrew packages used, this works on an M1 machine (the server hosted by William) with 10.5.beta5. In particular, suitesparse (where umfpack is) comes from Homebrew.

% otool -L venv/lib/python3.12/site-packages/cvxopt/umfpack.cpython-312-darwin.so
venv/lib/python3.12/site-packages/cvxopt/umfpack.cpython-312-darwin.so:
        /opt/homebrew/opt/suite-sparse/lib/libumfpack.6.dylib (compatibility version 6.0.0, current version 6.3.2)
        /opt/homebrew/opt/suite-sparse/lib/libcholmod.5.dylib (compatibility version 5.0.0, current version 5.2.0)
        /opt/homebrew/opt/suite-sparse/lib/libamd.3.dylib (compatibility version 3.0.0, current version 3.3.1)
        /opt/homebrew/opt/suite-sparse/lib/libcolamd.3.dylib (compatibility version 3.0.0, current version 3.3.2)
        /opt/homebrew/opt/suite-sparse/lib/libsuitesparseconfig.7.dylib (compatibility version 7.0.0, current version 7.6.0)
        /opt/homebrew/opt/openblas/lib/libopenblas.0.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2)
% uname -a
Darwin studio.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

Could your bug come from the way Sage builds suitesparse, rather than cvxopt?

dimpase avatar Oct 07 '24 12:10 dimpase

Yes the buildbot doesn't have homebrew.

The homebrew build clearly configures suitesparse the same way (no @rpath used).

Not sure its either a suitesparse or cvxopt bug, we just compile them with incompatible settings. Maybe documentation bug ;)

vbraun avatar Oct 07 '24 18:10 vbraun

so, perhaps, if we build suitesparse the way homebrew does it, we would solve this, without touching cvxopt?

dimpase avatar Oct 07 '24 19:10 dimpase

Yes, thats what I did in https://github.com/sagemath/sage/pull/38775, only change suitesparse to build without @rpath

vbraun avatar Oct 07 '24 22:10 vbraun