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

🐛 delta 0.4.5 binary release does not run on macOS 10.11 (El Capitan) #462

Closed
phil-blain opened this issue Dec 24, 2020 · 9 comments
Closed

Comments

@phil-blain
Copy link
Contributor

To replicate:

  1. download https://github.com/dandavison/delta/releases/tag/0.4.5 asset delta-0.4.5-x86_64-apple-darwin.tar.gz
  2. untar and cd to the extracted folder
  3. run ./delta --version:
$ ./delta --version
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
  Referenced from: /Users/Philippe/Downloads/delta-0.4.5-x86_64-apple-darwin 2/./delta
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ____chkstk_darwin
  Referenced from: /Users/Philippe/Downloads/delta-0.4.5-x86_64-apple-darwin 2/./delta
  Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5
@dandavison
Copy link
Owner

Thanks @phil-blain. That binary is working for me on MacOS 10.15.7 (Catalina). Quick googling brings up esy/esy#1169 (comment) and nodegui/nodegui#391 (comment) which suggest that the problem is that our GitHub Actions CD is building the MacOS binary on a recent version of MacOS:

        job:
          - { os: macos-latest,   target: x86_64-apple-darwin,         use-cross: false }

So one possibility would be to re-release with that os: set to an older version. However #463 reports that a binary is not working on Ubuntu 20.04, which I am still investigating. cc @marcoieni

@marcoieni
Copy link
Contributor

So one possibility would be to re-release with that os: set to an older version.

Sadly GitHub actions only support:

  • macOS Catalina 10.15 (macos-latest or macos-10.15) (this is what we are using)
  • macOS Big Sur 11.0 (macos-11.0)

See https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners#supported-runners-and-hardware-resources

I believe there is no older version.

@dandavison
Copy link
Owner

Hm, that's a shame. What should we do? MacOS users do have Homebrew and MacPorts as installation options. We could revert to Travis if we had to.

@marcoieni
Copy link
Contributor

marcoieni commented Dec 24, 2020

Travis uses mac os 10.13, see https://docs.travis-ci.com/user/reference/osx/#macos-version
But I think it's just a matter of time that they do the upgrade, too, so reverting to Travis might be useless in a couple of months, I don't know.

If it was my project I would remove support for El Captain for released binaries. Sorry to say this, but given what we know at the moment it might be the better choice in terms of threadoff between maintainers effort and users happiness :(
El Captain users could always build from scratch or use the other methods you have mentioned, which I am not familiar with.

Anyway it's up to you Dan!

Edit: with cargo install git-delta you can easily build from source.

@dandavison
Copy link
Owner

dandavison commented Dec 24, 2020

If it was my project I would remove support for El Captain for released binaries.

Yes, I think I agree. I've added a note to the README (If anyone knows where the problem starts in the El Capitan - Sierra - High Sierra - Mojave - Catalina sequence let me know and I can improve the README.)

Does this seem like the right decision to you @phil-blain? Are you OK installing from brew or cargo or direct from source?

@phil-blain
Copy link
Contributor Author

Well it's not the answer I was hoping for (10.11.6 is just over 2 years old, it's not that much), but as Marcoleni says it's your project :)

As far as I know, it's possible to build on newer macOS releases but target older releases, for example with clang you would use -mmacosx-version-min=10.11 or the environment variable MACOSX_DEPLOYMENT_TARGET. The rust book seems to imply that using this variable works, see https://rust-cli.github.io/book/tutorial/packaging.html#building-binary-releases-on-ci and the example linked there: https://github.com/rustwasm/wasm-pack/blob/51e6351c28fbd40745719e6d4a7bf26dadd30c85/.travis.yml#L85-L91

For now I've installed rust, and then delta using cargo. (Homebrew is really a pain to use on older systems because of its rolling release policy; it always wants to recompile OpenSSL each time I want to install a new package...)

@marcoieni
Copy link
Contributor

marcoieni commented Dec 24, 2020

Do you want to try to solve this?
You can:

  • fork the repository
  • edit the cd in order to add the environment variable on mac os
  • create a tag in order to trigger the github action
  • download the binary and try it on your machine
  • submit a PR if that works

If you have questions I can help you!

@phil-blain
Copy link
Contributor Author

I tried that and it works: see https://github.com/phil-blain/delta/releases/tag/0.4.6 and phil-blain@9c71fba

I added the variable to the environment for all jobs; the change was simpler this way and it should not cause any problem on non-macOS platforms. I'll submit a PR .

@dandavison
Copy link
Owner

Thanks @phil-blain, that sounds great.

phil-blain added a commit to phil-blain/delta that referenced this issue Dec 26, 2020
The binary release of delta 0.4.5 for macOS created by the "Continuous
Deployment" GitHub Actions workflow does not run on older macOS, like
10.11 (El Capitan) [1].

The Rust compiler, rustc, by default, will build macOS binaries
compatible with macOS 10.7 or newer [2], [3], but some *-sys crates invoke a
C compiler and thus will target the macOS version the C compiler is
running on [4], thus limiting the compatibility of the resulting
binary. The macOS virtual machines used on GitHub Actions run macOS
10.15.7, and since delta depends on some *-sys crates, the delta binary
built by cargo targets macOS 10.15, as can be verified by using the
following command:

    $ otool -l ./target/x86_64-apple-darwin/release/delta | grep LC_BUILD_VERSION -A4
    cmd LC_BUILD_VERSION
    cmdsize 32
    platform 1
    sdk 10.15.6
    minos 10.15

or, if building locally on an older macOS versions, (here 10.11):

    $ otool -l ./target/debug/delta | grep  LC_VERSION_MIN_MACOSX -A2
    cmd LC_VERSION_MIN_MACOSX
    cmdsize 16
    version 10.11

To restore compatibility with older macOS version, explicitely set the environment
variable `MACOSX_DEPLOYMENT_TARGET` to the default for rustc, "10.7".
This will make the `clang` C compiler invoked by *-sys crates also
target 10.7, thus restoring the compatibility of the delta binary.

For simplicity, add this variable to the environment for all platforms,
which should not have any effect on non-macOS platforms.

[1] dandavison#462
[2] https://github.com/rust-lang/rust/blob/65d053ab74d8c8c9c502b678acc265f3d7e2ac49/compiler/rustc_target/src/spec/apple_base.rs#L15-L17
[3] https://github.com/rust-lang/rust/blob/65d053ab74d8c8c9c502b678acc265f3d7e2ac49/compiler/rustc_target/src/spec/apple_base.rs#L53-L61
[4] https://users.rust-lang.org/t/compile-rust-binary-for-older-versions-of-mac-osx/38695/5
phil-blain added a commit to phil-blain/delta that referenced this issue Dec 26, 2020
The binary release of delta 0.4.5 for macOS created by the "Continuous
Deployment" GitHub Actions workflow does not run on older macOS, like
10.11 (El Capitan) [1].

The Rust compiler, rustc, by default, will build macOS binaries
compatible with macOS 10.7 or newer [2], [3], but some *-sys crates invoke a
C compiler and thus will target the macOS version the C compiler is
running on [4], thus limiting the compatibility of the resulting
binary. The macOS virtual machines used on GitHub Actions run macOS
10.15.7, and since delta depends on some *-sys crates, the delta binary
built by cargo targets macOS 10.15, as can be verified by using the
following command:

    $ otool -l ./target/x86_64-apple-darwin/release/delta | grep LC_BUILD_VERSION -A4
    cmd LC_BUILD_VERSION
    cmdsize 32
    platform 1
    sdk 10.15.6
    minos 10.15

or, if building locally on an older macOS versions, (here 10.11):

    $ otool -l ./target/debug/delta | grep  LC_VERSION_MIN_MACOSX -A2
    cmd LC_VERSION_MIN_MACOSX
    cmdsize 16
    version 10.11

To restore compatibility with older macOS version, explicitely set the environment
variable `MACOSX_DEPLOYMENT_TARGET` to the default for rustc, "10.7".
This will make the `clang` C compiler invoked by *-sys crates also
target 10.7, thus restoring the compatibility of the delta binary.

For simplicity, add this variable to the environment for all platforms,
which should not have any effect on non-macOS platforms.

[1] dandavison#462
[2] https://github.com/rust-lang/rust/blob/65d053ab74d8c8c9c502b678acc265f3d7e2ac49/compiler/rustc_target/src/spec/apple_base.rs#L15-L17
[3] https://github.com/rust-lang/rust/blob/65d053ab74d8c8c9c502b678acc265f3d7e2ac49/compiler/rustc_target/src/spec/apple_base.rs#L53-L61
[4] https://users.rust-lang.org/t/compile-rust-binary-for-older-versions-of-mac-osx/38695/5
dandavison pushed a commit that referenced this issue Dec 26, 2020
The binary release of delta 0.4.5 for macOS created by the "Continuous
Deployment" GitHub Actions workflow does not run on older macOS, like
10.11 (El Capitan) [1].

The Rust compiler, rustc, by default, will build macOS binaries
compatible with macOS 10.7 or newer [2], [3], but some *-sys crates invoke a
C compiler and thus will target the macOS version the C compiler is
running on [4], thus limiting the compatibility of the resulting
binary. The macOS virtual machines used on GitHub Actions run macOS
10.15.7, and since delta depends on some *-sys crates, the delta binary
built by cargo targets macOS 10.15, as can be verified by using the
following command:

    $ otool -l ./target/x86_64-apple-darwin/release/delta | grep LC_BUILD_VERSION -A4
    cmd LC_BUILD_VERSION
    cmdsize 32
    platform 1
    sdk 10.15.6
    minos 10.15

or, if building locally on an older macOS versions, (here 10.11):

    $ otool -l ./target/debug/delta | grep  LC_VERSION_MIN_MACOSX -A2
    cmd LC_VERSION_MIN_MACOSX
    cmdsize 16
    version 10.11

To restore compatibility with older macOS version, explicitely set the environment
variable `MACOSX_DEPLOYMENT_TARGET` to the default for rustc, "10.7".
This will make the `clang` C compiler invoked by *-sys crates also
target 10.7, thus restoring the compatibility of the delta binary.

For simplicity, add this variable to the environment for all platforms,
which should not have any effect on non-macOS platforms.

[1] #462
[2] https://github.com/rust-lang/rust/blob/65d053ab74d8c8c9c502b678acc265f3d7e2ac49/compiler/rustc_target/src/spec/apple_base.rs#L15-L17
[3] https://github.com/rust-lang/rust/blob/65d053ab74d8c8c9c502b678acc265f3d7e2ac49/compiler/rustc_target/src/spec/apple_base.rs#L53-L61
[4] https://users.rust-lang.org/t/compile-rust-binary-for-older-versions-of-mac-osx/38695/5
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