Library not loaded libgmp.10.dylib on self-hosted macos M1

See original GitHub issue

using: self-hosted macOS (M1 chip)

- name: Install ruby
  uses: ruby/setup-ruby@v1
  env:
    ImageOS: macos1015

1st libgmp.10.dylib error:

The installation failed on “Print Ruby version” step with the error below:

Reason: tried: '/usr/local/opt/gmp/lib/libgmp.10.dylib' (no such file), '/usr/local/lib/libgmp.10.dylib' (no such file), '/usr/lib/libgmp.10.dylib' (no such file)

image

I have gmp installed with homebrew and hence the libgmp.10.dylib is located under /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib

2nd libgmp.10.dylib error

I manually installed gmp to ensure /usr/local/lib/libgmp.10.dylib will be available

but then, got a new error:

'/usr/local/lib/libgmp.10.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Shahaedcommented, Sep 7, 2022

I’m not entirely sure a symlink is accepted (depends on https://github.com/actions/toolkit/tree/main/packages/tool-cache), but it’s worth a try.

It won’t. The tool checks the .../actions-runner/_work/_tool/Ruby/{version}/{os_architecture} for existing cache and if it doesn’t exist this action will download a new on into the hostedtoolcache folder and overwrite whatever is there.

Since Github Actions supports M1 self hosted runners it would be nice for this action to have the MacOS arm builds. However automating that is obviously hard since Github doesn’t have any MacOS arm runners.

1reaction
magnusspcommented, Sep 9, 2022

After some more headache with this problem I don’t think @Shahaed python script will solve the issue for me. I already have an arm64 built binary of Ruby installed on the machine via rbenv. The python script only seem to care about homebrew installs.

So my solution was to create a symlinks in /Users/runner/hostedtoolcache to the rbenv install of Ruby similar to how @Shahaed python script does for homebrew installed Cellars.

Then I have a script that is run before runner jobs that will execute ln -fs /Users/runner/hostedtoolcache/Ruby /Users/runner/actions-runner/_work/_tool

So in short

# create symlinks in hostedtoolcache to rbenv install
ln -s /Users/runner/.rbenv/versions/3.1.2 /Users/runner/hostedtoolcache/Ruby/3.1.2/arm64
ln -s /Users/runner/.rbenv/versions/3.1.2 /Users/runner/hostedtoolcache/Ruby/3.1.2/x86
ln -s /Users/runner/.rbenv/versions/3.1.2 /Users/runner/hostedtoolcache/Ruby/3.1.2/x64
touch /Users/runner/hostedtoolcache/Ruby/3.1.2/arm64.complete
touch /Users/runner/hostedtoolcache/Ruby/3.1.2/x86.complete
touch /Users/runner/hostedtoolcache/Ruby/3.1.2/x64.complete

# have a script run at job startup by the github runner that runs the following command
ln -fs /Users/runner/hostedtoolcache/Ruby /Users/runner/actions-runner/_work/_tool

This can be a temporary solution for those with rbenv ruby until this action, setup-ruby, have solved arm64 macos builds that are pulled down by the action.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib ...
dylib ) works for each terminal session, but not permanently. I am running OS 10.9.5. This is what works temporarily: rvm reinstall 2.1.4....
Read more >
dyld: Library not loaded: /usr/local/lib/libgmp.10.dylib ... - GitHub
Now that everything is installed, here is the error popping up when i load in Vim on OSX: syntastic: error: checker output: dyld:...
Read more >
Unable to bootstrap GDK - missing `libgmp.10.dylib` - GitLab
Overview I have GMP installed (and did brew reinstall gmp too), ... dyld[53684]: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib ...
Read more >
Issues · ruby/setup-ruby · GitHub
Library not loaded libgmp.10.dylib on self-hosted macos M1. #341 opened May 18, 2022 by m2hd1 · 16. Consider bundle groups in cache keys....
Read more >
incompatible library version | Apple Developer Forums
It says `gmp` in the correct path is not loaded since its version is `13.0.0`, but it is `14.0.0`! I know I have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found