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

Issue with gems on M1 that depends on ox #297

Closed
Panajev opened this issue Sep 24, 2022 · 3 comments
Closed

Issue with gems on M1 that depends on ox #297

Panajev opened this issue Sep 24, 2022 · 3 comments

Comments

@Panajev
Copy link

Panajev commented Sep 24, 2022

Hello @ohler55 and everyone due to a dependency to the this gem, it appears the danger-junit report functionality is broken on M1 machines, have you run into this issue? Do you have any advice or could you offer any help to work around this problem with danger-junit?

We are not sure how M1/arm64e support could be added or fixed (if present already) in Ox, is this something that could be considered?

We are also trying to raise it with danger-junit to see if there a workaround possible there: orta/danger-junit#33

/CI/Jenkins/workspace/tests-NA-all-commits-ios-Lobby-pr/ruby_path/ruby/3.1.0/gems/ox-2.14.11/lib/ox.rb:79:in `require': dlopen(/CI/Jenkins/workspace/tests-NA-all-commits-ios-Lobby-pr/ruby_path/ruby/3.1.0/gems/ox-2.14.11/ext/ox/ox.bundle, 0x0009): tried: '/CI/Jenkins/workspace/tests-NA-all-commits-ios-Lobby-pr/ruby_path/ruby/3.1.0/gems/ox-2.14.11/ext/ox/ox.bundle' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) - 

We researched the issue and tried the commonly suggested workarounds like:

Ensuring all gems would be installed with the native extensions recompiled for the host machine:

bundle config set --local force_ruby_platform true

and/or

bundle config set force_ruby_platform true

We do have ruby as one of the supported platforms in our Gemfile.lock btw:

PLATFORMS
  arm64-darwin-21
  ruby
  x86_64-darwin-19
  x86_64-darwin-20
  x86_64-darwin-21

Adding the following platform restriction in the Gemfile:

# HACK(bouk): Overwrite Bundler's platform matcher to ignore universal CPU
# The protobuf and gRPC 'universal' macOS gems break on M1
module Bundler::MatchPlatform
    def match_platform(p)
      return false if ::Gem::Platform === platform && platform.cpu == "universal"
      Bundler::MatchPlatform.platforms_match?(platform, p)
    end
end

But nothing seems to do the trick :/...


References: protocolbuffers/protobuf#8199 (and similar ones)

@ohler55
Copy link
Owner

ohler55 commented Sep 25, 2022

Can you provide a simple test that demonstrates how Ox is broken on M1 machines? I actually use an M1 for development and I have had no issues with it or the unit tests.

@Panajev
Copy link
Author

Panajev commented Oct 4, 2022

Hello @ohler55 apologies, I had a quite long reply I was working on but scrapped it because... as it turns out it was a stupid issue although curious too. We were using AdoptOpenJDK's JDK11 on the M1 based agents and this was resulting in the local setup being done in native aarch64 mode while the Jenkins CI agent jar was launched from an x86_64 context resulting in the hilarity above.

There are some other issues on Monterey 12.6 + Xcode 14, but they do not seem to affect this scenario in particular.

Solution: for us it was as simple as migrating to Temerin's JDK11 which has a native Apple Silicon version.

@Panajev Panajev closed this as completed Oct 4, 2022
@ohler55
Copy link
Owner

ohler55 commented Oct 4, 2022

Glad you got it worked out.

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

2 participants