Skip to content

On Darwin, ignore anything but system's ranlib. Fixes #1812#1813

Merged
flavorjones merged 1 commit intosparklemotion:masterfrom
gpakosz:darwin-ranlib
Dec 1, 2018
Merged

On Darwin, ignore anything but system's ranlib. Fixes #1812#1813
flavorjones merged 1 commit intosparklemotion:masterfrom
gpakosz:darwin-ranlib

Conversation

@gpakosz
Copy link
Copy Markdown
Contributor

@gpakosz gpakosz commented Nov 2, 2018

This PR makes it so the call to libxml2's configure script is done with passing RANLIB=/usr/bin/ranlib when running on Darwin.

This makes building native extensions more robust to the target system in the following situation:

  • the user is using macOS and
  • the user has GNU binutils in her PATH
  • or somewhat, GNU binutils are linked in /usr/local/bin

In particular, having libxml2 build call GNU's ranlib instead of Darwin's ranlib fails building native extensions with very cryptic error messages. The root cause is far from being obvious and one can waste many hours on it.

As such, I suggest trying to spare users and maintainers' time (less issues opened) by helping libxml2's build system a bit.

@flavorjones
Copy link
Copy Markdown
Member

This is related to #1812

@flavorjones
Copy link
Copy Markdown
Member

/cc @zenspider Can you please take a look at this.

@nurse
Copy link
Copy Markdown
Contributor

nurse commented Nov 21, 2018

@zenspider @flavorjones I hit this many times for each my environments...
When will you merge and release new nokogiri gem?

@flavorjones
Copy link
Copy Markdown
Member

@nurse Can you confirm that this fix addresses your issue? I have no easy way to test.

@gpakosz
Copy link
Copy Markdown
Contributor Author

gpakosz commented Nov 21, 2018

@nurse Now I'm curious. Do you have GNU's ranlib in your PATH in each of your environments? Why is it so?

Comment thread ext/nokogiri/extconf.rb Outdated
@nurse
Copy link
Copy Markdown
Contributor

nurse commented Nov 24, 2018

@flavorjones It also needs AR=/usr/bin/ar and libxslt also needs the hack. With such change, I confirmed it works on my environment.

@gpakosz I want to have addr2line and GNU's objdump.
Well but there's few people who want to do that..

Comment thread ext/nokogiri/extconf.rb Outdated
@flavorjones
Copy link
Copy Markdown
Member

Will take a look in the morning. The failing tests in CI are unrelated.

@flavorjones flavorjones merged commit da13fa3 into sparklemotion:master Dec 1, 2018
@flavorjones
Copy link
Copy Markdown
Member

Merged into master.

@flavorjones flavorjones added this to the next milestone Dec 1, 2018
@nurse
Copy link
Copy Markdown
Contributor

nurse commented Dec 13, 2018

Thank you for releasing 1.9.0.rc1 and I successfully installed it!

%  ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin16]
%  gem install nokogiri --pre
Fetching: mini_portile2-2.4.0.gem (100%)
Successfully installed mini_portile2-2.4.0
Fetching: nokogiri-1.9.0.rc1.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.9.0.rc1
Parsing documentation for mini_portile2-2.4.0
Installing ri documentation for mini_portile2-2.4.0
Parsing documentation for nokogiri-1.9.0.rc1
Installing ri documentation for nokogiri-1.9.0.rc1
Done installing documentation for mini_portile2, nokogiri after 13 seconds
2 gems installed
%  /usr/local/bin/ranlib --version
GNU ranlib (GNU Binutils) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

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

Successfully merging this pull request may close these issues.

3 participants