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

Explore precompiled binaries for Darwin (OSX) #2063

Closed
1 task done
flavorjones opened this issue Aug 18, 2020 · 13 comments
Closed
1 task done

Explore precompiled binaries for Darwin (OSX) #2063

flavorjones opened this issue Aug 18, 2020 · 13 comments

Comments

@flavorjones
Copy link
Member

flavorjones commented Aug 18, 2020

This is a placeholder for a future conversation (with myself?) about precompiling Darwin libraries, similarly to how we've shipped precompiled libraries for Windows since ~v1.4 and how we will hopefully ship for Linux in v1.11.0.

cc @larskanis @tenderlove tell me if you think I'm crazy for thinking we can do this.


Here's what I've learned so far

(I'll keep this section up to date as I go along)

Architecture names relevant to us

  • RUBY_PLATFORM
    • used to identify the ruby architecture
    • which on my linux system is "x86_64-linux"
    • using OSX system Ruby is "universal.x86_64-darwin19"
    • using OSX homebrew- or rvm-installed Ruby is "x86_64-darwin19"
  • Gem::Platform.new(RUBY_PLATFORM)
    • used by rake-compiler to name native tasks
    • on my linux system is "x86_64-linux"
    • using OSX system Ruby is "universal.x86_64-darwin-19" (note the addition of a "-" before the "19")
    • using OSX homebrew- or rvm-installed Ruby is "x86_64-darwin-19" (note the "-" here also)
  • Gem::Platform.local
    • used by rubygems to search for an appropriate native platform gem
    • on my linux system is "x86_64-linux"
    • using OSX system Ruby is "universal-darwin-19"
    • using OSX homebrew- or rvm-installed Ruby is "x86_64-darwin-19"

Needed changes to Nokogiri to support OSX

Invoke the properly-named gem task:

diff --git a/tasks/cross-ruby.rb b/tasks/cross-ruby.rb
index 35c098f..1d5c2fd 100644
--- a/tasks/cross-ruby.rb
+++ b/tasks/cross-ruby.rb
@@ -179,7 +181,7 @@ namespace "gem" do
       task "guest" do
         # use Task#invoke because the pkg/*gem task is defined at runtime
         Rake::Task["native:#{plat}"].invoke
-        Rake::Task["pkg/#{HOE.spec.full_name}-#{plat}.gem"].invoke
+        Rake::Task["pkg/#{HOE.spec.full_name}-#{Gem::Platform.new(plat).to_s}.gem"].invoke
       end
     end
   end

Compatibility

If Ruby is configured with --enable-shared, the shared object libraries generated will contain references to libruby (and possibly other libraries like libgmp, libcrypt, and librt).

This means that a shared object library built by a ruby that was configured with --enabled-shared can't be run by a ruby that was configured with --disabled-shared. However, a shared object library built by a ruby that was configured with --disable-shared seems to run fine in a ruby configured with --enable-shared.

It's possible to hack the shared object files to get around this. See here for how rake-compiler-dock gets around this:

And it's possible on a Mac to modify the .bundle file path to contain @rpath and then make sure that DYLD_LIBRARY_PATH is set appropriately. Some resources on this topic:

But these seem like unnatural workarounds, and so I'm going to attempt to use a Ruby built with --disable-shared to generate the precompiled native gem for darwin.

  • Publish the recipe for building that version of Ruby so that it's reproducible.

Universal architecture

The OSX system ruby has an architecture of "universal.x86_64" which ... I'm not sure what that is. I started googling and found:

which implies that Universal is a binary that would work for both x86_64 and arm 64.

@flavorjones
Copy link
Member Author

flavorjones commented Aug 31, 2020

@larskanis I'm hoping you can help clarify some things for me. There seems to be a few different platform name values on OSX and I'm not sure how to configure the cross-ruby tasks to do a proof-of-concept native darwin build.

TL;DR:

On Linux, all three of these values are the same:

  • RUBY_PLATFORM # => "x86_64-linux"
  • Gem::Platform.new(RUBY_PLATFORM).to_s # => "x86_64-linux"
  • gem env reports x86_64-linux as one of the "RUBYGEMS PLATFORMS"

On OSX, running the system Ruby, all three of these values are different:

  • RUBY_PLATFORM # => "universal.x86_64-darwin19"
  • Gem::Platform.new(RUBY_PLATFORM).to_s # => "universal.x86_64-darwin-19"
  • gem env reports universal-darwin-19 as one of the "RUBYGEMS PLATFORMS"

Edit addition: On OSX, running the homebrew-installed Ruby OR an rvm-installed Ruby, all three of these values are different in different ways:

  • RUBY_PLATFORM # => "x86_64-darwin19"
  • Gem::Platform.new(RUBY_PLATFORM).to_s # => "x86_64-darwin-19"
  • gem env reports x86_64-darwin-19 as one of the "RUBYGEMS PLATFORMS"

Longer explanation

First, the native tasks are defined in rake-compiler's Rake::ExtensionTask#define_native_tasks. Right now this method is being called from #define with no arguments, and so platf is set to platform which returns RUBY_PLATFORM when @platform isn't set -- and so this value on a mac is universal.x86_64-darwin19.

This matches what ruby -v tells me: ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19].

gem env, however, says the platform is universal-darwin-19.

Finally, though, if I add universal.x86_64-darwin19 to both .cross_rubies and tasks/cross-ruby.rb:

  def platform
    @platform ||= case host
      when /\Ax86_64.*mingw32/
        "x64-mingw32"
      when /\Ai[3-6]86.*mingw32/
        "x86-mingw32"
      when /\Ax86_64.*linux/
        "x86_64-linux"
      when /\Ai[3-6]86.*linux/
        "x86-linux"
      when /\Auniversal.x86_64-darwin19/
        "universal.x86_64-darwin19"
      else
        raise "unsupported host: #{host}"
      end
  end

then the error I see is:

Don't know how to build task 'pkg/nokogiri-1.11.0.rc2-universal.x86_64-darwin19.gem' (See the list of available tasks with `rake --tasks`)
Did you mean?  pkg/nokogiri-1.11.0.rc2-universal.x86_64-darwin-19.gem

which implies the existence of a THIRD platform name which inserts a space between "darwin" and "19" -- and I discovered that this is the spec platform which is set to Gem::Platform.new(platf) inside define_native_tasks:

Gem::Platform.new("universal.x86_64-darwin19").to_s
=> "universal.x86_64-darwin-19"

I can't quite put all the pieces together and make this work, but it feels like this might be pointing towards an inconsistency in how these names are handled in rake-compiler?

@flavorjones
Copy link
Member Author

@larskanis I'm also happy to send a PR to rake-compiler if that's what's needed to sort this out -- I'm only asking for your advice on what solution to pursue! I'll keep playing around.

@flavorjones
Copy link
Member Author

OK, I managed to build a working native darwin gem by applying the following patch!

diff --git a/.cross_rubies b/.cross_rubies
index 57c8fb0..e3f5f1e 100644
--- a/.cross_rubies
+++ b/.cross_rubies
@@ -2,6 +2,7 @@
 2.7.0:x86_64-w64-mingw32
 2.7.0:i686-linux-gnu
 2.7.0:x86_64-linux-gnu
+2.7.0:universal-darwin-19
 2.6.0:i686-w64-mingw32
 2.6.0:x86_64-w64-mingw32
 2.6.0:i686-linux-gnu
diff --git a/Rakefile b/Rakefile
index f5f6f47..16be862 100644
--- a/Rakefile
+++ b/Rakefile
@@ -118,6 +118,7 @@ else
   end
 
   Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
+    ext.platform = "universal-darwin-19"
     ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
     ext.config_options << ENV['EXTOPTS']
     ext.cross_compile  = true
diff --git a/tasks/cross-ruby.rb b/tasks/cross-ruby.rb
index 35c098f..d4e84bd 100644
--- a/tasks/cross-ruby.rb
+++ b/tasks/cross-ruby.rb
@@ -26,6 +26,8 @@ CrossRuby = Struct.new(:version, :host) do
         "x86_64-linux"
       when /\Ai[3-6]86.*linux/
         "x86-linux"
+      when /\Auniversal-darwin-19/
+        "universal-darwin-19"
       else
         raise "unsupported host: #{host}"
       end

and then running rake gem:universal-darwin-19:guest -- because obviously we don't have a guest container.

$ time gem install pkg/nokogiri-1.11.0.rc2-universal-darwin-19.gem 
Successfully installed nokogiri-1.11.0.rc2-universal-darwin-19
1 gem installed

real	0m0.795s
user	0m0.350s
sys	0m0.185s

$ ruby -S nokogiri -v
# Nokogiri (1.11.0.rc2)
    ---
    warnings: []
    nokogiri: 1.11.0.rc2
    ruby:
      version: 2.7.1
      platform: x86_64-darwin19
      description: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
      engine: ruby
    libxml:
      source: packaged
      patches:
      - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
      - 0002-Remove-script-macro-support.patch
      - 0003-Update-entities-to-remove-handling-of-ssi.patch
      - 0004-libxml2.la-is-in-top_builddir.patch
      - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
      compiled: 2.9.10
      loaded: 2.9.10
    libxslt:
      source: packaged
      patches: []
      compiled: 1.1.34
      loaded: 1.1.34

@flavorjones
Copy link
Member Author

Ah, this is actually better and addresses the root problem: that we're trying to invoke the wrongly-named rake task:

diff --git a/.cross_rubies b/.cross_rubies
index 57c8fb0..e884b16 100644
--- a/.cross_rubies
+++ b/.cross_rubies
@@ -2,6 +2,7 @@
 2.7.0:x86_64-w64-mingw32
 2.7.0:i686-linux-gnu
 2.7.0:x86_64-linux-gnu
+2.7.0:x86_64-darwin19
 2.6.0:i686-w64-mingw32
 2.6.0:x86_64-w64-mingw32
 2.6.0:i686-linux-gnu
diff --git a/tasks/cross-ruby.rb b/tasks/cross-ruby.rb
index 35c098f..1d5c2fd 100644
--- a/tasks/cross-ruby.rb
+++ b/tasks/cross-ruby.rb
@@ -26,6 +26,8 @@ CrossRuby = Struct.new(:version, :host) do
         "x86_64-linux"
       when /\Ai[3-6]86.*linux/
         "x86-linux"
+      when /\Ax86_64-darwin19/
+        "x86_64-darwin19"
       else
         raise "unsupported host: #{host}"
       end
@@ -179,7 +181,7 @@ namespace "gem" do
       task "guest" do
         # use Task#invoke because the pkg/*gem task is defined at runtime
         Rake::Task["native:#{plat}"].invoke
-        Rake::Task["pkg/#{HOE.spec.full_name}-#{plat}.gem"].invoke
+        Rake::Task["pkg/#{HOE.spec.full_name}-#{Gem::Platform.new(plat).to_s}.gem"].invoke
       end
     end
   end

And the output file is now nokogiri-1.11.0.rc2-x86_64-darwin-19.gem which is TOTALLY GOING TO WORK because gem env will be looking for the same platform name.

@flavorjones
Copy link
Member Author

Voila:

huygens (master *)
nokogiri $ time gem install pkg/nokogiri-1.11.0.rc2-x86_64-darwin-19.gem
Successfully installed nokogiri-1.11.0.rc2-x86_64-darwin-19
1 gem installed

real	0m0.764s
user	0m0.355s
sys	0m0.187s

huygens (master *)
nokogiri $ ruby -S nokogiri -v
# Nokogiri (1.11.0.rc2)
    ---
    warnings: []
    nokogiri: 1.11.0.rc2
    ruby:
      version: 2.7.1
      platform: x86_64-darwin19
      description: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
      engine: ruby
    libxml:
      source: packaged
      patches:
      - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
      - 0002-Remove-script-macro-support.patch
      - 0003-Update-entities-to-remove-handling-of-ssi.patch
      - 0004-libxml2.la-is-in-top_builddir.patch
      - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
      compiled: 2.9.10
      loaded: 2.9.10
    libxslt:
      source: packaged
      patches: []
      compiled: 1.1.34
      loaded: 1.1.34

@flavorjones
Copy link
Member Author

Maybe worth noting: if I build the binary gem using homebrew-installed ruby 2.7, but install it into an rvm-installed ruby 2.7, it installs but I get this error at runtime:

$ nokogiri -v
Traceback (most recent call last):
	9: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
	8: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
	7: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/nokogiri:23:in `<main>'
	6: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/nokogiri:23:in `load'
	5: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/bin/nokogiri:6:in `<top (required)>'
	4: from /Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	3: from /Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	2: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/lib/nokogiri.rb:13:in `<top (required)>'
	1: from /Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- nokogiri/2.7/nokogiri (LoadError)
	10: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
	 9: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
	 8: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/nokogiri:23:in `<main>'
	 7: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/bin/nokogiri:23:in `load'
	 6: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/bin/nokogiri:6:in `<top (required)>'
	 5: from /Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	 4: from /Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	 3: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/lib/nokogiri.rb:11:in `<top (required)>'
	 2: from /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/lib/nokogiri.rb:15:in `rescue in <top (required)>'
	 1: from /Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': dlopen(/Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /usr/local/opt/ruby/lib/libruby.2.7.dylib (LoadError)
  Referenced from: /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/lib/nokogiri/nokogiri.bundle
  Reason: image not found - /Users/flavorjones/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.11.0.rc2-x86_64-darwin-19/lib/nokogiri/nokogiri.bundle

But then when I re-build the gem with rvm-installed ruby, and then install the gem, it works fine:

# Nokogiri (1.11.0.rc2)
    ---
    warnings: []
    nokogiri: 1.11.0.rc2
    ruby:
      version: 2.7.0
      platform: x86_64-darwin19
      description: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
      engine: ruby
    libxml:
      source: packaged
      patches:
      - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
      - 0002-Remove-script-macro-support.patch
      - 0003-Update-entities-to-remove-handling-of-ssi.patch
      - 0004-libxml2.la-is-in-top_builddir.patch
      - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
      compiled: 2.9.10
      loaded: 2.9.10
    libxslt:
      source: packaged
      patches: []
      compiled: 1.1.34
      loaded: 1.1.34

The problem is that both of those rubies (homebrew-installed and rvm-installed) have the same RUBY_PLATFORM and gem env platform. 🤔

@flavorjones
Copy link
Member Author

On linux, dynamic libraries are names searched for in a runtime path (LD_LIBRARY_PATH):

$ ldd lib/nokogiri/nokogiri.so 
	linux-vdso.so.1 (0x00007ffcdff91000)
	libruby.so.2.5 => not found
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fabb8487000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fabb846b000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fabb8448000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fabb8254000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fabb8a2a000)

On OSX this is what I see:

nokogiri $ otool -L lib/nokogiri/nokogiri.bundle
lib/nokogiri/nokogiri.bundle:
	/Users/flavorjones/.rvm/rubies/ruby-2.7.0/lib/libruby.2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/local/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.5.0)
	/usr/local/opt/zlib/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)

@flavorjones
Copy link
Member Author

This blog post has some good info on linker paths on OSX, along with links to deeper reference material: https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172

@larskanis
Copy link
Member

@flavorjones Congrats for building OSX binary gems!

In rake-compiler-dock we use a nasty trick to avoid library name mismatches to libruby: We don't link the shared object of the gem to libruby at all, but assume that libruby is already loaded and symbols can be resolved that way. See here and here.

So the shared object on Linux has the following dependencies:

$ ldd pkg/nokogiri-1.11.0.rc2-x86_64-linux/lib/nokogiri/2.7/nokogiri.so 
	linux-vdso.so.1 (0x00007fff413ca000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5b23f10000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5b23d1e000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f5b244d8000)

@flavorjones
Copy link
Member Author

@larskanis I noticed that last night (something I had not seen before)!

It looks like when ruby is configured without --enable-shared that it might not link to libruby (based only on looking at the .bundle generated by rubies configured with and without that option). I need to test more rigorously that this is the case, but either way I understand more deeply what's going on now and can probably hack something. I'll update this issue when I learn more!

@flavorjones
Copy link
Member Author

flavorjones commented Sep 4, 2020

Confirmed, setting --enable-shared or --disable-shared affects whether libruby.so is linked-to from nokogiri.so. And confirmed that a nokogiri.so generated by a --disable-shared ruby runs fine in the --enable-shared ruby (but the reverse is not true).

Ruby build with --enable-shared:

juno ruby-2.7.0 go1.14.6 (master *)
nokogiri $ ruby -e 'puts RbConfig::CONFIG["configure_args"]'
 '--prefix=/home/flavorjones/.rvm/rubies/ruby-2.7.0' '--disable-install-doc' '--enable-shared'

juno ruby-2.7.0 go1.14.6 (master *)
nokogiri $ be rake lib/nokogiri/nokogiri.so
install -c tmp/x86_64-linux/nokogiri/2.7.0/nokogiri.so lib/nokogiri/nokogiri.so
cp tmp/x86_64-linux/nokogiri/2.7.0/nokogiri.so tmp/x86_64-linux/stage/lib/nokogiri/nokogiri.so

juno ruby-2.7.0 go1.14.6 (master *)
nokogiri $ ldd lib/nokogiri/nokogiri.so 
	linux-vdso.so.1 (0x00007ffc2b3e8000)
	libruby.so.2.7 => /home/flavorjones/.rvm/rubies/ruby-2.7.0/lib/libruby.so.2.7 (0x00007fd440168000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd43fff9000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fd43ffd0000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd43ffb4000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd43fdc0000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd43fd9d000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd43fd92000)
	libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007fd43fd0e000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd43fd08000)
	libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fd43fccd000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd440974000)

juno ruby-2.7.0 go1.14.6 (master *)
nokogiri $ ls -l lib/nokogiri/nokogiri.so 
-rwxrwxr-x 1 flavorjones flavorjones 2876352 2020-09-04 10:37 lib/nokogiri/nokogiri.so*

juno ruby-2.7.0 go1.14.6 (master *)
nokogiri $ nm lib/nokogiri/nokogiri.so | fgrep rb_gc_mark
                 U rb_gc_mark

Ruby built with --disable-shared:

juno ruby-2.7.1 go1.14.6 (master *)
nokogiri $ ruby -e 'puts RbConfig::CONFIG["configure_args"]'
 '--prefix=/home/flavorjones/.rvm/rubies/ruby-2.7.1' '--disable-shared' '--disable-install-doc'

juno ruby-2.7.1 go1.14.6 (master *)
nokogiri $ be rake lib/nokogiri/nokogiri.so
install -c tmp/x86_64-linux/nokogiri/2.7.1/nokogiri.so lib/nokogiri/nokogiri.so
cp tmp/x86_64-linux/nokogiri/2.7.1/nokogiri.so tmp/x86_64-linux/stage/lib/nokogiri/nokogiri.so

juno ruby-2.7.1 go1.14.6 (master *)
nokogiri $ ldd lib/nokogiri/nokogiri.so
	linux-vdso.so.1 (0x00007ffdd8f58000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8e5f900000)
	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8e5f8d7000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8e5f8bb000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8e5f6c9000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8e5fcaf000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8e5f6a4000)

juno ruby-2.7.1 go1.14.6 (master *)
nokogiri $ ls -l lib/nokogiri/nokogiri.so
-rwxrwxr-x 1 flavorjones flavorjones 2876240 2020-09-04 10:38 lib/nokogiri/nokogiri.so*

juno ruby-2.7.1 go1.14.6 (master *)
nokogiri $ nm lib/nokogiri/nokogiri.so | fgrep rb_gc_mark
                 U rb_gc_mark

@flavorjones flavorjones mentioned this issue Sep 7, 2020
1 task
@flavorjones
Copy link
Member Author

Update:

  • pull request at Darwin native gems #2073 seems to work for x86_64-darwin for ruby 2.4, 2.5, 2.6, 2.7.
    • which includes a recipe for installing a set of rubies for building the native gems at scripts/setup-osx-native-builders
  • I won't ship a separate universal-darwin-19 gem unless and until people ask (and I'll note that the x86_64-darwin-19 gem works for the system ruby that self-identifies as universal-darwin-19, even if the platform strings don't match)

@flavorjones
Copy link
Member Author

Closing. Will cut an rc3 with darwin native gems, and will point people to #2075 to provide feedback.

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

No branches or pull requests

2 participants