Skip to content

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

Closed

Description

@m2hd1

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

Activity

  1. arelstone commented on May 19, 2022

    @arelstone

    I am facing the same issue.

    I want to be able to make an internal release of our ios app when merging to the develop branch. We've acquired a MacMini M1 (2020) that I will be using as a self hosted runner.

    I've created a user runner which has admin rights.

    rvm is installed and the correct version of ruby (2.7.4) has been installed too.

    % su - runner
    
    % rvm list
    =* ruby-2.7.4 [ arm64 ]
    
    # => - current
    # =* - current && default
    #  * - default
    
    % ruby --version
    ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [arm64-darwin21]

    The runner is working and I can see that it picks up the jobs as it should.

    The workflow:

    name: Deploy internal release
    on:
      workflow_dispatch:
    
    jobs:
      setup:
        name: IOS Internal Release
        runs-on: self-hosted
        steps:
          - uses: actions/checkout@v3
          - name: whoami
            run: |
              whoami
              ruby --version
          
          - name: Setup Ruby
            uses: ruby/setup-ruby@v1
            with:
              bundler-cache: true
            env:
              ImageOS: macos12

    Output from workflow:

    2022-05-19T08:11:37.8828760Z Requested labels: self-hosted
    2022-05-19T08:11:37.8828872Z Job defined at: paralenz/mobile/.github/workflows/deploy-internal-release.yml@refs/heads/develop
    2022-05-19T08:11:37.8828897Z Waiting for a runner to pick up this job...
    2022-05-19T08:11:38.5908649Z Job is about to start running on the runner: Lukes-Mac-mini (repository)
    2022-05-19T08:11:44.7688010Z Current runner version: '2.291.1'
    2022-05-19T08:11:44.7727160Z Runner name: 'Lukes-Mac-mini'
    2022-05-19T08:11:44.7728600Z Runner group name: 'Default'
    2022-05-19T08:11:44.7732000Z Machine name: 'Lukes-Mac-mini'
    2022-05-19T08:11:44.7735920Z ##[group]GITHUB_TOKEN Permissions
    2022-05-19T08:11:44.7737840Z Actions: write
    2022-05-19T08:11:44.7738080Z Checks: write
    2022-05-19T08:11:44.7738230Z Contents: write
    2022-05-19T08:11:44.7738400Z Deployments: write
    2022-05-19T08:11:44.7738560Z Discussions: write
    2022-05-19T08:11:44.7738710Z Issues: write
    2022-05-19T08:11:44.7738850Z Metadata: read
    2022-05-19T08:11:44.7739000Z Packages: write
    2022-05-19T08:11:44.7739150Z Pages: write
    2022-05-19T08:11:44.7739300Z PullRequests: write
    2022-05-19T08:11:44.7739500Z RepositoryProjects: write
    2022-05-19T08:11:44.7739690Z SecurityEvents: write
    2022-05-19T08:11:44.7739850Z Statuses: write
    2022-05-19T08:11:44.7740000Z ##[endgroup]
    2022-05-19T08:11:44.7745180Z Secret source: Actions
    2022-05-19T08:11:44.7747240Z Prepare workflow directory
    2022-05-19T08:11:44.9014490Z Prepare all required actions
    2022-05-19T08:11:44.9153540Z Getting action download info
    2022-05-19T08:11:45.2843280Z Download action repository 'actions/checkout@v3' (SHA:2541b1294d2704b0964813337f33b291d3f8596b)
    2022-05-19T08:11:46.2841430Z Download action repository 'ruby/setup-ruby@v1' (SHA:8029ebd6e5bd8f4e0d6f7623ea76a01ec5b1010d)
    2022-05-19T08:11:47.1503640Z Download action repository 'actions/cache@v2' (SHA:937d24475381cd9c75ae6db12cb4e79714b926ed)
    2022-05-19T08:11:48.2965500Z ##[group]Run actions/checkout@v3
    2022-05-19T08:11:48.2966230Z with:
    2022-05-19T08:11:48.2967730Z   token: ***
    2022-05-19T08:11:48.2968060Z   repository: paralenz/mobile
    2022-05-19T08:11:48.2968280Z   ssh-strict: true
    2022-05-19T08:11:48.2968500Z   persist-credentials: true
    2022-05-19T08:11:48.2968720Z   clean: true
    2022-05-19T08:11:48.2968950Z   fetch-depth: 1
    2022-05-19T08:11:48.2969130Z   lfs: false
    2022-05-19T08:11:48.2969330Z   submodules: false
    2022-05-19T08:11:48.2969560Z   set-safe-directory: true
    2022-05-19T08:11:48.2969790Z ##[endgroup]
    2022-05-19T08:11:48.5832650Z Syncing repository: paralenz/mobile
    2022-05-19T08:11:48.5838760Z ##[group]Getting Git version info
    2022-05-19T08:11:48.5840140Z Working directory is '/Users/runner/actions-runner/_work/mobile/mobile'
    2022-05-19T08:11:48.5840800Z [command]/usr/bin/git version
    2022-05-19T08:11:48.5912140Z git version 2.32.1 (Apple Git-133)
    2022-05-19T08:11:48.5955620Z ##[endgroup]
    2022-05-19T08:11:48.6041040Z Temporarily overriding HOME='/Users/runner/actions-runner/_work/_temp/46a25e61-c4b8-487c-abe0-eca67a4ab2ba' before making global git config changes
    2022-05-19T08:11:48.6044420Z Adding repository directory to the temporary git global config as a safe directory
    2022-05-19T08:11:48.6053250Z [command]/usr/bin/git config --global --add safe.directory /Users/runner/actions-runner/_work/mobile/mobile
    2022-05-19T08:11:48.6347630Z [command]/usr/bin/git config --local --get remote.origin.url
    2022-05-19T08:11:48.6508250Z https://github.com/paralenz/mobile
    2022-05-19T08:11:48.6652950Z ##[group]Removing previously created refs, to avoid conflicts
    2022-05-19T08:11:48.6654230Z [command]/usr/bin/git rev-parse --symbolic-full-name --verify --quiet HEAD
    2022-05-19T08:11:48.6752450Z refs/heads/develop
    2022-05-19T08:11:48.6753430Z [command]/usr/bin/git checkout --detach
    2022-05-19T08:11:48.7125240Z HEAD is now at 01bcc01 👷 Check ruby version
    2022-05-19T08:11:48.7155050Z [command]/usr/bin/git rev-parse --symbolic-full-name --branches
    2022-05-19T08:11:48.7299060Z refs/heads/develop
    2022-05-19T08:11:48.7321590Z [command]/usr/bin/git branch --delete --force develop
    2022-05-19T08:11:48.7476640Z Deleted branch develop (was 01bcc01).
    2022-05-19T08:11:48.7524430Z [command]/usr/bin/git rev-parse --symbolic-full-name --remotes=origin
    2022-05-19T08:11:48.7669990Z refs/remotes/origin/develop
    2022-05-19T08:11:48.7692780Z ##[endgroup]
    2022-05-19T08:11:48.7693330Z ##[group]Cleaning the repository
    2022-05-19T08:11:48.7694040Z [command]/usr/bin/git clean -ffdx
    2022-05-19T08:11:48.7977100Z [command]/usr/bin/git reset --hard HEAD
    2022-05-19T08:11:48.8221630Z HEAD is now at 01bcc01 👷 Check ruby version
    2022-05-19T08:11:48.8246460Z ##[endgroup]
    2022-05-19T08:11:48.8251740Z ##[group]Disabling automatic garbage collection
    2022-05-19T08:11:48.8261570Z [command]/usr/bin/git config --local gc.auto 0
    2022-05-19T08:11:48.8441070Z ##[endgroup]
    2022-05-19T08:11:48.8464420Z ##[group]Setting up auth
    2022-05-19T08:11:48.8564700Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    2022-05-19T08:11:48.8650310Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
    2022-05-19T08:11:49.0084530Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
    2022-05-19T08:11:49.0252560Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
    2022-05-19T08:11:49.1572070Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
    2022-05-19T08:11:49.1758210Z ##[endgroup]
    2022-05-19T08:11:49.1758890Z ##[group]Fetching the repository
    2022-05-19T08:11:49.1772920Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +01bcc0172e56d0306cee2485911dcb45d697088b:refs/remotes/origin/develop
    2022-05-19T08:11:49.7505510Z remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
    2022-05-19T08:11:49.8090580Z ##[endgroup]
    2022-05-19T08:11:49.8091700Z ##[group]Determining the checkout info
    2022-05-19T08:11:49.8093740Z ##[endgroup]
    2022-05-19T08:11:49.8094970Z ##[group]Checking out the ref
    2022-05-19T08:11:49.8105210Z [command]/usr/bin/git checkout --progress --force -B develop refs/remotes/origin/develop
    2022-05-19T08:11:49.8359420Z Switched to a new branch 'develop'
    2022-05-19T08:11:49.8368960Z Branch 'develop' set up to track remote branch 'develop' from 'origin'.
    2022-05-19T08:11:49.8380020Z ##[endgroup]
    2022-05-19T08:11:49.8591780Z [command]/usr/bin/git log -1 --format='%H'
    2022-05-19T08:11:49.8740880Z '01bcc0172e56d0306cee2485911dcb45d697088b'
    2022-05-19T08:11:49.9330060Z ##[group]Run whoami
    2022-05-19T08:11:49.9333870Z �[36;1mwhoami�[0m
    2022-05-19T08:11:49.9344080Z �[36;1mruby --version�[0m
    2022-05-19T08:11:49.9381830Z shell: /bin/bash -e {0}
    2022-05-19T08:11:49.9382030Z ##[endgroup]
    2022-05-19T08:11:49.9790860Z runner
    2022-05-19T08:11:49.9911820Z ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [arm64-darwin21]
    2022-05-19T08:11:50.0050700Z ##[group]Run ruby/setup-ruby@v1
    2022-05-19T08:11:50.0050980Z with:
    2022-05-19T08:11:50.0051210Z   bundler-cache: true
    2022-05-19T08:11:50.0051430Z   ruby-version: default
    2022-05-19T08:11:50.0051690Z env:
    2022-05-19T08:11:50.0051900Z   ImageOS: macos12
    2022-05-19T08:11:50.0052120Z ##[endgroup]
    2022-05-19T08:11:50.1472090Z Using 2.7.4 as input from file .ruby-version
    2022-05-19T08:11:50.1515210Z ##[group]Modifying PATH
    2022-05-19T08:11:50.1515560Z Entries removed from PATH to avoid conflicts with default Ruby:
    2022-05-19T08:11:50.1515990Z   /Users/runner/.rvm/gems/ruby-2.7.4/bin
    2022-05-19T08:11:50.1516330Z   /Users/runner/.rvm/gems/ruby-2.7.4@global/bin
    2022-05-19T08:11:50.1519320Z   /Users/runner/.rvm/rubies/ruby-2.7.4/bin
    2022-05-19T08:11:50.1523520Z Entries added to PATH to use selected Ruby:
    2022-05-19T08:11:50.1523830Z   /Users/runner/hostedtoolcache/Ruby/2.7.4/x64/bin
    2022-05-19T08:11:50.1524310Z ##[endgroup]
    2022-05-19T08:11:50.4828080Z ##[group]Downloading Ruby
    2022-05-19T08:11:50.4829940Z https://github.com/ruby/ruby-builder/releases/download/toolcache/ruby-2.7.4-macos-latest.tar.gz
    2022-05-19T08:11:51.6569860Z Took   1.17 seconds
    2022-05-19T08:11:51.6571370Z ##[endgroup]
    2022-05-19T08:11:51.6572160Z ##[group]Extracting  Ruby
    2022-05-19T08:11:51.6636920Z [command]/usr/bin/tar -xz -C /Users/runner/hostedtoolcache/Ruby/2.7.4 -f /Users/runner/actions-runner/_work/_temp/4da5bbc2-83bd-4d72-96e9-0d7d4ef7e21f
    2022-05-19T08:11:52.4941700Z Took   0.84 seconds
    2022-05-19T08:11:52.4963560Z ##[endgroup]
    2022-05-19T08:11:52.4985990Z ##[group]Print Ruby version
    2022-05-19T08:11:52.4992850Z [command]/Users/runner/hostedtoolcache/Ruby/2.7.4/x64/bin/ruby --version
    2022-05-19T08:11:53.0548850Z dyld[96266]: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
    2022-05-19T08:11:53.0551290Z   Referenced from: /Users/runner/hostedtoolcache/Ruby/2.7.4/x64/bin/ruby
    2022-05-19T08:11:53.0552190Z   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)
    2022-05-19T08:11:53.0562070Z Took   0.56 seconds
    2022-05-19T08:11:53.0564740Z ##[endgroup]
    2022-05-19T08:11:53.0641230Z ##[error]Error: The process '/Users/runner/hostedtoolcache/Ruby/2.7.4/x64/bin/ruby' failed with exit code null
        at ExecState._setResult (/Users/runner/actions-runner/_work/_actions/ruby/setup-ruby/v1/dist/index.js:4918:25)
        at ExecState.CheckComplete (/Users/runner/actions-runner/_work/_actions/ruby/setup-ruby/v1/dist/index.js:4901:18)
        at ChildProcess.<anonymous> (/Users/runner/actions-runner/_work/_actions/ruby/setup-ruby/v1/dist/index.js:4795:27)
        at ChildProcess.emit (node:events:390:28)
        at maybeClose (node:internal/child_process:1064:16)
        at Socket.<anonymous> (node:internal/child_process:450:11)
        at Socket.emit (node:events:390:28)
        at Pipe.<anonymous> (node:net:687:12)
    2022-05-19T08:11:53.0830400Z Post job cleanup.
    2022-05-19T08:11:53.2066930Z [command]/usr/bin/git version
    2022-05-19T08:11:53.2222700Z git version 2.32.1 (Apple Git-133)
    2022-05-19T08:11:53.2274780Z Temporarily overriding HOME='/Users/runner/actions-runner/_work/_temp/726f074d-a979-45cc-a938-d65c0780bab5' before making global git config changes
    2022-05-19T08:11:53.2279400Z Adding repository directory to the temporary git global config as a safe directory
    2022-05-19T08:11:53.2284300Z [command]/usr/bin/git config --global --add safe.directory /Users/runner/actions-runner/_work/mobile/mobile
    2022-05-19T08:11:53.2443720Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    2022-05-19T08:11:53.2618550Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
    2022-05-19T08:11:53.4075460Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
    2022-05-19T08:11:53.4221290Z http.https://github.com/.extraheader
    2022-05-19T08:11:53.4253010Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
    2022-05-19T08:11:53.4409470Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
    2022-05-19T08:11:53.6086220Z Uploading runner diagnostic logs
    2022-05-19T08:11:53.6403230Z Completed runner diagnostic log upload
    2022-05-19T08:11:53.6403540Z Cleaning up orphan processes
    
  2. eregon commented on May 23, 2022

    @eregon
    Member

    Short answer: this action and the the built Rubies do not support any other architecture than x86_64.
    We should probably update it to error early in that case.

    It might still work on M1 if Rosetta 2 is installed though, but then you need to make sure the exact same dependencies are installed as on GitHub action, and specifically here a x86_64 /usr/local/opt/gmp/lib/libgmp.10.dylib.

  3. m2hd1 commented on May 24, 2022

    @m2hd1
    Author

    bummer, thanks @eregon

    any plan to support M1 in the near future ?

  4. eregon commented on May 26, 2022

    @eregon
    Member

    any plan to support M1 in the near future ?

    We'd need M1 GitHub-hosted runners for that, so I can build the releases.
    Until then, no, but it might work if installing Rosetta 2 and the needed dependencies with amd64 Homebrew.
    I might consider adding a way to build your own ruby and use it with setup-ruby, but that seems a separate issue somewhat.

    According to https://tenderlovemaking.com/2022/01/07/homebrew-rosetta-and-ruby.html, /usr/local should be amd64 Homebrew, and so /usr/local/lib/libgmp.10.dylib should be amd64 but it seems aarch64 in your case.
    So I guess you manually copied /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib to /usr/local/lib/libgmp.10.dylib, which is pretty wrong, do not mix architectures like that please.

    To run under Rosetta you should install amd64 Homebrew (as explained in the blog post) and install gmp in amd64 Homebrew.

  5. m2hd1 commented on May 26, 2022

    @m2hd1
    Author

    @eregon thanks for the reply and the workaround !

    We'd need M1 GitHub-hosted runners for that, so I can build the releases.

    oh I see, bummer it can't be built from the runners you have :(

    So I guess you manually copied /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib to /usr/local/lib/libgmp.10.dylib,

    no, I uninstalled the homebrew ruby and then built and installed ruby from the source
    probably I can try building an x86/x64 build and see if that helps ...

  6. kuhnroyal commented on Jul 8, 2022

    @kuhnroyal

    any plan to support M1 in the near future ?

    We'd need M1 GitHub-hosted runners for that, so I can build the releases. Until then, no, but it might work if installing Rosetta 2 and the needed dependencies with amd64 Homebrew. I might consider adding a way to build your own ruby and use it with setup-ruby, but that seems a separate issue somewhat.

    According to https://tenderlovemaking.com/2022/01/07/homebrew-rosetta-and-ruby.html, /usr/local should be amd64 Homebrew, and so /usr/local/lib/libgmp.10.dylib should be amd64 but it seems aarch64 in your case. So I guess you manually copied /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib to /usr/local/lib/libgmp.10.dylib, which is pretty wrong, do not mix architectures like that please.

    To run under Rosetta you should install amd64 Homebrew (as explained in the blog post) and install gmp in amd64 Homebrew.

    This is no exactly correct. There are 3 different homebrew folders:

    /usr/local/opt - x86 on x86 devices
    /usr/local/homebrew/opt - x86 on arm64 devices
    /opt/homebrew - arm65 on arm64 devices

    Anyways, I now have the action working on M1.
    You can follow https://medium.com/mkdir-awesome/how-to-install-x86-64-homebrew-packages-on-apple-m1-macbook-54ba295230f to install brew for x86 and enable Rosetta.

    Afterwards use the new brew to install the required packages
    arch -x86_64 /usr/local/homebrew/bin/brew install gmp libyaml rvm (or use your alias).
    These are installed into /usr/local/homebrew/opt. But this folder is not checked when ruby is looking for the libraries.
    So just create a symbolic link sudo ln -s /usr/local/homebrew/opt /usr/local/opt and you are done.

  7. rgaufman commented on Aug 7, 2022

    @rgaufman

    I already have ruby working on M1, I do not have rosetta and trying to avoid it as specs run much slower. Any solution to this? - I like the idea of being able to just use my existing working ruby.

  8. eregon commented on Aug 7, 2022

    @eregon
    Member

    @rgaufman This needs better docs, but this should already work if you build your own ruby in the hosted tool cache and create the "complete" file:

    setup-ruby/common.js

    Lines 165 to 186 in 6148f40

    function getPlatformToolCache(platform) {
    // Hardcode paths rather than using $RUNNER_TOOL_CACHE because the prebuilt Rubies cannot be moved anyway
    if (platform.startsWith('ubuntu-')) {
    return '/opt/hostedtoolcache'
    } else if (platform.startsWith('macos-')) {
    return '/Users/runner/hostedtoolcache'
    } else if (platform.startsWith('windows-')) {
    return 'C:/hostedtoolcache/windows'
    } else {
    throw new Error('Unknown platform')
    }
    }
    export function getToolCacheRubyPrefix(platform, version) {
    const toolCache = getPlatformToolCache(platform)
    return path.join(toolCache, 'Ruby', version, 'x64')
    }
    export function createToolCacheCompleteFile(toolCacheRubyPrefix) {
    const completeFile = `${toolCacheRubyPrefix}.complete`
    fs.writeFileSync(completeFile, '')
    }

    That's the overall approach of GitHub Actions for self-hosted runners and the hosted tool cache.

  9. rgaufman commented on Aug 10, 2022

    @rgaufman

    @eregon Ah, interesting, so if I for example just create a symlink to the ruby and bundle binaries in /Users/runner/hostedtoolcache/bin/ - that should just work?

  10. eregon commented on Aug 10, 2022

    @eregon
    Member

    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.

  11. rgaufman commented on Aug 15, 2022

    @rgaufman

    I ended up just commenting out ruby-setup and adding the path to my ruby. Not a perfect solution but a good enough workaround as we standardise on a single Ruby version across the code bases, hope this is useful for someone:

    name: "Ruby on Rails CI"
    on: [push, pull_request]
    jobs:
      test:
        runs-on: self-hosted
        env:
          RAILS_ENV: test
        steps:
          - uses: actions/checkout@v3
    
          # - name: Install Ruby and gems
          #   uses: ruby/setup-ruby@v1
          #   with:
          #     bundler-cache: true
    
          - run: echo /usr/local/opt/ruby/bin >> $GITHUB_PATH
          - run: cp config/secrets.yml.sample config/secrets.yml
          - run: bundle install --quiet
          - run: bundle exec rails db:prepare
          - run: bundle exec rspec
    
  12. Shahaed commented on Sep 7, 2022

    @Shahaed

    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.

  13. Shahaed commented on Sep 7, 2022

    @Shahaed

    For anyone that wants to keep using this action and also use the ARM build of Ruby here's a python script that you can run before each job (How to run script on self hosted runners).

    It will link all homebrew installs to the tools cache. Script doesn't handle older version (i.e. Ruby@2.7) but can easily be modified to do that.

    https://gist.github.com/Shahaed/a37c62bd89bf85c649fc0e72fd4d6d94

  14. eregon commented on Sep 7, 2022

    @eregon
    Member

    It won't.

    I'm confused, it seems to work given it works with your script which does use symlinks, right?

  15. magnussp commented on Sep 9, 2022

    @magnussp

    For anyone that wants to keep using this action and also use the ARM build of Ruby here's a python script that you can run before each job (How to run script on self hosted runners).

    It will link all homebrew installs to the tools cache. Script doesn't handle older version (i.e. Ruby@2.7) but can easily be modified to do that.

    https://gist.github.com/Shahaed/a37c62bd89bf85c649fc0e72fd4d6d94

    @Shahaed in which dir are you expecting your script to be placed to work?

  16. magnussp commented on Sep 9, 2022

    @magnussp

    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.

  17. Shahaed commented on Sep 21, 2022

    @Shahaed

    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.

    Yup @magnussp, I did the bare minimum to make the actions run on the mac mini and installed all dependencies with Brew. Since we're only doing iOS development having multiple version of Ruby with rbenv (etc) wasn't a big deal.

    I like your solution of also filling the hostedtoolcache folder as well and then symlinking from there. Might help other setup-xxx actions. Depends on how they're written I assume.

  18. akarabach commented on Oct 3, 2022

    @akarabach

    Any updates on it ?

  19. eregon commented on Oct 3, 2022

    @eregon
    Member

    Nothing we can do until GitHub has GitHub-hosted darwin-aarch64 runners.

  20. eregon commented on Mar 3, 2023

    @eregon
    Member

    With #473 this action now gives instructions for how to make it work for self-hosted runners not matching a GitHub-hosted runner image.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions