镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add Darwin ARM target #14

Description

@lloeki
  • as manual build
  • as CI build

Activity

  1. vseguin commented on Jan 18, 2021

    @vseguin

    Hey @lloeki ! Great to see this being worked on, do you have an idea when this could be released?
    We use sqreen as a dependency in our app and for new developers with Apple M1 chips we have to comment it out for now.

  2. lloeki commented on Jan 19, 2021

    @lloeki
    CollaboratorAuthor

    @vseguin I released a build based on node 15.5.1 just yesterday, sq_mini_racer 0.3.1.0.3 and Sqreen should just work now on M1.

  3. vseguin commented on Jan 19, 2021

    @vseguin

    @lloeki is it pushed to rubygems?
    I get

      ERROR: found gems matching libv8-node:'~> 15.5.1.0.beta1', but no binary for -darwin-20
             try "gem install libv8-node:'~> 15.5.1.0.beta1'" to attempt to build libv8-node from source
    

    I bumped sqreen to 1.23.0 - which seems to resolve to sq_mini_racer 0.3.1.03.

  4. lloeki commented on Jan 19, 2021

    @lloeki
    CollaboratorAuthor

    I suppose you're trying to use macOS's own Ruby, which you can check with ruby -e 'puts RUBY_PLATFORM' or ruby -e 'p Gem.platforms'. Unfortunately this Apple-provided Ruby is built as arm64e, and currently libv8 builds as arm64.

    I encourage you to try installing your own Ruby e.g. through rbenv install.

  5. vseguin commented on Jan 22, 2021

    @vseguin

    @lloeki so hum sorry to come back on this, but I confirmed I am on rbenv's Ruby 2.7.1

    ruby -e 'p Gem.platforms'
    ["ruby", #<Gem::Platform:0x000000014d0bf880 @cpu="", @os="darwin", @version="20" @cpu="", @os="darwin", @version="20">]
    
    ruby -e 'puts RUBY_PLATFORM' 
    -darwin20
    

    I tried this and it seems that's it's only "-darwin20", no arm64 or arm64e?

  6. lloeki commented on Jan 25, 2021

    @lloeki
    CollaboratorAuthor

    @vseguin Can you run file or lipo on it?

    Examples:

    $ lipo -info /usr/bin/ruby 
    Architectures in the fat file: /usr/bin/ruby are: x86_64 arm64e 
    $ lipo -info ~/.rbenv/versions/2.7.2/bin/ruby
    Non-fat file: /Users/lloeki/.rbenv/versions/2.7.2/bin/ruby is architecture: x86_64
    
  7. sweetppro commented on Jan 28, 2021

    @sweetppro

    Im also having issues installing on my M1 MacBook Air...
    here's my setup:

    me % ruby -e 'p Gem.platforms'
    ["ruby", #<Gem::Platform:0x000000013f020d88 @cpu="", @os="darwin", @version="20">]
    me % ruby -e 'puts RUBY_PLATFORM'
    -darwin20
    
    me % lipo -info /usr/bin/ruby 
    Architectures in the fat file: /usr/bin/ruby are: x86_64 arm64e 
    me % lipo -info ~/.rbenv/versions/2.6.5/bin/ruby
    Non-fat file: /Users/mrqwirk/.rbenv/versions/2.6.5/bin/ruby is architecture: arm64
    

    and the error:

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        current directory: /Users/me/myapp/gems/ruby/2.6.0/gems/sq_mini_racer-0.3.1.0.3/ext/mini_racer_extension
    /Users/me/.rbenv/versions/2.6.5/bin/ruby -I /Users/me/.rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210128-7070-s9t894.rb extconf.rb
      ERROR: found gems matching libv8-node:'~> 15.5.1.0.beta1', but no binary for -darwin-20
             try "gem install libv8-node:'~> 15.5.1.0.beta1'" to attempt to build libv8-node from source
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers.  Check the mkmf.log file for more details.  You may
    need configuration options.
    
    Provided configuration options:
    	--with-opt-dir
    	--without-opt-dir
    	--with-opt-include
    	--without-opt-include=${opt-dir}/include
    	--with-opt-lib
    	--without-opt-lib=${opt-dir}/lib
    	--with-make-prog
    	--without-make-prog
    	--srcdir=.
    	--curdir
    	--ruby=/Users/me/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
    platform ruby:-darwin20 rubygems:-darwin-20 detected:-darwin-20
    looking for libv8-node-*--darwin-20 in ["/Users/me/myapp/gems/ruby/2.6.0"]
    libv8-node-*--darwin-20 not found in ["/Users/me/myapp/gems/ruby/2.6.0"]
    looking for libv8-node-*--darwin-20 in ["/Users/me/myapp/gems/ruby/2.6.0/gems/sq_mini_racer-0.3.1.0.3/ext/mini_racer_extension/vendor"]
    libv8-node-*--darwin-20 not found in ["/Users/me/myapp/gems/ruby/2.6.0/gems/sq_mini_racer-0.3.1.0.3/ext/mini_racer_extension/vendor"]
    
    extconf failed, exit code 1
    
  8. lloeki commented on Jan 28, 2021

    @lloeki
    CollaboratorAuthor

    Looks like the same deal: platform ruby:-darwin20 rubygems:-darwin-20 detected:-darwin-20

    This is output straight from Ruby's RUBY_PLATFORM and Gem::Platform.local, so it's Ruby itself that's hosed right there.

    I see you're running 2.6.x in rbenv. Unfortunately as far as I can tell Ruby 2.7.x is the first Ruby version supporting arm64-darwin, that could very well explain why 2.6.x has a broken RUBY_PLATFORM.

    Indeed, there's ruby/ruby@f469298 where you can read the following items:

    • Fix build error on Apple silicon macOS
    • Extract correct processor name for ARM64 Macs

    And the patchset contains other important fixes for Apple Silicon (the desc is a bit obscured in the commit message, but there's important stuff regarding coroutines, without which you'd get seemingly random segfaults). It's apparently just followed by ruby/ruby@811b2b0 which is the bump to 2.7.2.

    Of course Apple provides their own 2.6 with a set of patches of their own, but it's heavily deprecated and doesn't contain some of the fixes above.

    So my suggestion would be to stick to 2.7.2 and up on M1, unless you want to backport that patchset (at least, there may be more needed).

  9. sweetppro commented on Jan 28, 2021

    @sweetppro

    Ah,
    That’s an easy fix.
    Thanks for the heads up.

  10. sweetppro commented on Jan 28, 2021

    @sweetppro

    So my suggestion would be to stick to 2.7.2 and up on M1, unless you want to backport that patchset (at least, there may be more needed).

    worked like a charm!
    many thanks

  11. lloeki commented on Feb 18, 2021

    @lloeki
    CollaboratorAuthor

    Apple's Ruby 2.6 is not to be relied on. Truly universal builds are painful, and Apple's Ruby is the only instance of it.

    Reports all around say it works fine for all non-Apple, non-universal >2.7.2 rubies.

    No CI yet.

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