Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer works w/o kludges on Mac OS X versions (<10.12) which are still supported by official Python #11786

Closed
TurtleWilly opened this issue Jun 6, 2024 · 3 comments

Comments

@TurtleWilly
Copy link

$ ./ruff --help
dyld: lazy symbol binding failed: Symbol not found: _os_unfair_lock_trylock
  Referenced from: /Volumes/Temporary/ruff (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _os_unfair_lock_trylock
  Referenced from: /Volumes/Temporary/ruff (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5

(on Mac OS X 10.10.5 aka Yosemite, an OS version still officially supported by Python/CPython)

Note: ruff version 0.1.2 from end of last year which I had previously installed did not have this issue.

It's still possible to temporarily/ awkwardly workaround it by injecting the legacy support support library from the MacPorts project, so it really should be just a minor compatibility issue really:

$ DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=/usr/local/lib/libMacportsLegacySupport.dylib \
  ruff --version
ruff 0.4.8

Likewise trying to install it via pip is a sad outcome (used to work before too)

$ python3.12 -m venv foobar
$ cd foobar/
$ source ./bin/activate
(foobar) $ pip install ruff
Collecting ruff
  Downloading ruff-0.4.8.tar.gz (2.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 6.1 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [57 lines of output]
      Collecting maturin<2.0,>=1.0
        Downloading maturin-1.6.0.tar.gz (187 kB)
           ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 187.9/187.9 kB 2.6 MB/s eta 0:00:00
        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 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: maturin
        Building wheel for maturin (pyproject.toml): started
        Building wheel for maturin (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for maturin (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [34 lines of output]
            /private/var/folders/b7/***REDACTED***/T/pip-build-env-dm4wttt1/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:83: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
              corresp(dist, value, root_dir)
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib.macosx-10.9-universal2-cpython-312
            creating build/lib.macosx-10.9-universal2-cpython-312/maturin
            copying maturin/__init__.py -> build/lib.macosx-10.9-universal2-cpython-312/maturin
            copying maturin/__main__.py -> build/lib.macosx-10.9-universal2-cpython-312/maturin
            copying maturin/import_hook.py -> build/lib.macosx-10.9-universal2-cpython-312/maturin
            running egg_info
            creating maturin.egg-info
            writing maturin.egg-info/PKG-INFO
            writing dependency_links to maturin.egg-info/dependency_links.txt
            writing requirements to maturin.egg-info/requires.txt
            writing top-level names to maturin.egg-info/top_level.txt
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest template 'MANIFEST.in'
            warning: no files found matching '*.json' under directory 'src/python_interpreter'
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            running build_ext
            running build_rust
            error: failed to parse manifest at `/private/var/folders/b7/***REDACTED***/T/pip-install-5wc38rd9/maturin_1c9e0ae9cb1a47d4a6545f02c734b4be/Cargo.toml`
      
            Caused by:
              failed to parse the `edition` key
      
            Caused by:
              this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.
            error: `cargo metadata --manifest-path Cargo.toml --format-version 1 --locked` failed with code 101
            -- Output captured from stdout:
      
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for maturin
      Failed to build maturin
      ERROR: Could not build wheels for maturin, which is required to install pyproject.toml-based projects
      [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.

So no luck on that route either (albeit that doesn't look like ruff's fault.) The Rust ecosystem really gives nothing about any sort of backwards compatibility it seems. 😢

@charliermarsh
Copy link
Member

I don't think we can support macOS 10. It's extremely EOL -- even macOS 11 is EOL and has been for almost a year, right?

@MichaReiser
Copy link
Member

Yeah I don't think we can support it. Rust dropped sierra support with Rust 1.74 which is the minimal rust version that we require.

I just tried and we can't downgrade below 1.74 because we make use of the new cargo lints configuration.

@TurtleWilly
Copy link
Author

Rust and Go are the worst offenders when it comes to basic compatibility. I can compile C programs from the 80 w/o problems, or get the latest C compiler, but running simple Rust or Go commands is a big disaster. Just broken ecosystems, IMHO.

Anyway… if someone else stumbles onto this problem, here's the proper solution. We can replace the the linked libSystem.B.dylib in the ruff binary with a wrapper library which inserts the missing functions and passes the rest along to Apple's libSystem.B.dylib afterwards:

$ otool -L ruff
ruff:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)

$ install_name_tool -change /usr/lib/libSystem.B.dylib /usr/local/lib/libMacportsLegacySystem.B.dylib ruff

$ otool -L ruff
ruff:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/local/lib/libMacportsLegacySystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)

$ ./ruff --version
ruff 0.4.8

The legacy wrappers are available here: https://github.com/macports/macports-legacy-support or alternatively here: https://ports.macports.org/port/legacy-support/details/

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

No branches or pull requests

3 participants