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

Homebrew development commands fail to install some gems on Mojave on Xcode >10 #5561

Closed
fxcoudert opened this issue Jan 19, 2019 · 58 comments
Closed
Labels
in progress Maintainers are working on this outdated PR was locked due to age

Comments

@fxcoudert
Copy link
Member

fxcoudert commented Jan 19, 2019

What you were trying to do (and why)

Run brew audit on any formula, e.g., brew audit gmp.

What happened (include command output)

The error is Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Full output below:

Command output
  
Fetching gem metadata from https://rubygems.org/........
Using ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Using docile 1.3.1
Using simplecov-html 0.10.2
Using tins 1.20.2
Using thor 0.19.4
Using diff-lcs 1.3
Fetching hpricot 0.8.6
Fetching jaro_winkler 1.5.2
Installing jaro_winkler 1.5.2 with native extensions
Installing json 2.1.0 with native extensions
Installing hpricot 0.8.6 with native extensions
Using mustache 1.1.0
Using parallel 1.13.0
Using parser 2.6.0.0
Using powerpack 0.1.2
Using rainbow 3.0.0
Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Using rspec-support 3.8.0
Using ruby-progressbar 1.10.0
Using unicode-display_width 1.4.1
Using term-ansicolor 1.7.1
Using parallel_tests 2.27.1
Using rspec-core 3.8.0
Using rspec-expectations 3.8.2
Using rspec-mocks 3.8.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/generator
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190119-5767-u1kt7r.rb extconf.rb
creating Makefile

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/generator
make "DESTDIR=" clean

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error:
'ruby/config.h' file not found
#include "ruby/config.h"
^~~~~~~~~~~~~~~
1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0 for
inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.1.0/gem_make.out

An error occurred while installing json (2.1.0), and Bundler cannot continue.
Make sure that gem install json -v '2.1.0' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile:
coveralls was resolved to 0.8.22, which depends on
simplecov was resolved to 0.16.1, which depends on
json

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190119-5767-4udt80.rb extconf.rb
creating Makefile

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
make "DESTDIR=" clean

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
make "DESTDIR="
make: *** No rule to make target
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h', needed by adj_matrix.o'. Stop.

make failed, exit code 2

Gem files will remain installed in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2 for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.2/gem_make.out

An error occurred while installing jaro_winkler (1.5.2), and Bundler cannot continue.
Make sure that gem install jaro_winkler -v '1.5.2' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile:
rubocop was resolved to 0.63.0, which depends on
jaro_winkler
Error: cannot load such file -- rubocop
Please report this bug:
https://docs.brew.sh/Troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
/usr/local/Homebrew/Library/Homebrew/style.rb:21:in check_style_impl' /usr/local/Homebrew/Library/Homebrew/style.rb:14:in check_style_json'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:149:in audit' /usr/local/Homebrew/Library/Homebrew/brew.rb:102:in

'

Reproducibility

At first, I thought it was only a problem on my machine, and linked to me having /usr/include populated under Mojave (which is not supposed to happen) due to a faulty CLT update from Apple.

However, I have now removed and reinstalled both CLT and Xcode, and nuked that faulty include directory, meaning I now have a “normal” Mojave system, and it still happens. Other users have been reporting it, for example here Homebrew/homebrew-core#36156 and there Homebrew/homebrew-core#35934, so there definitely is something to fix here.

Why do I believe it is a brew issue, and not a ruby issue? I have never in my life used Ruby outside of brew, so if something messed it up, it must be brew-related 😢

Have I tried to fix it?

I have run rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle ~/.gem (per @MikeMcQuaid's advice), then brew tests. The tests fail with the same error as above.

Additional info

$ brew config
HOMEBREW_VERSION: 1.9.2-35-gcf32929
ORIGIN: https://github.com/Homebrew/brew
HEAD: cf32929116b2d5193bad9d78cc627d097cf7612c
Last commit: 28 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b7dc0849fc14d3914073e89653442f6e1ce98886
Core tap last commit: 15 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BINTRAY_KEY: set
HOMEBREW_BINTRAY_USER: fxcoudert
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/fx/Library/Logs/Homebrew
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
CPU: dodeca-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_144
macOS: 10.14.2-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
@claui claui self-assigned this Jan 19, 2019
@MikeMcQuaid
Copy link
Member

Need your ‘brew config’ and ‘xcode-select —print-path’

@susemeee
Copy link

I am experiencing same issue with brew audit and managed to run the command with setting HOMEBREW_DEVELOPER and HOMEBREW_RUBY_PATH(to use ruby with rvm).

brew config

HOMEBREW_VERSION: 1.9.2-35-gcf32929
ORIGIN: https://github.com/Homebrew/brew
HEAD: cf32929116b2d5193bad9d78cc627d097cf7612c
Last commit: 18 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b7dc0849fc14d3914073e89653442f6e1ce98886
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/susem/Library/Logs/Homebrew
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_152
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11

xcode-select -p

/Library/Developer/CommandLineTools

@fxcoudert
Copy link
Member Author

brew config and other requested info added at the end of my report.

@reitermarkus
Copy link
Member

This is a Mojave bug:

Homebrew/homebrew-cask#52775 (comment)

@okgolove
Copy link

Same problem.
vendor-install didn't help.
Is there an another way to fix it?

@MikeMcQuaid
Copy link
Member

@fxcoudert Have you tried export HOMEBREW_FORCE_VENDOR_RUBY=1?

@fxcoudert
Copy link
Member Author

fxcoudert commented Jan 21, 2019

@MikeMcQuaid setting HOMEBREW_FORCE_VENDOR_RUBY did not fix the issue, but the error is slightly different:

$ echo $HOMEBREW_FORCE_VENDOR_RUBY
1
$ brew config
HOMEBREW_VERSION: 1.9.2-44-g70c5b6f
ORIGIN: https://github.com/Homebrew/brew
HEAD: 70c5b6f8044785cb4a33878d34e020d34caacf2d
Last commit: 20 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: f97971163fab073832eccee4921a5cdd29ae8dbe
Core tap last commit: 68 seconds ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BINTRAY_KEY: set
HOMEBREW_BINTRAY_USER: fxcoudert
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_FORCE_VENDOR_RUBY: 1
HOMEBREW_LOGS: /Users/fx/Library/Logs/Homebrew
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
CPU: dodeca-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_144
macOS: 10.14.2-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
$ brew audit gmp
==> Installing or updating 'bundler' gem
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
Fetching gem metadata from https://rubygems.org/........
Fetching ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Fetching docile 1.3.1
Installing ast 2.4.0
Installing docile 1.3.1
Fetching simplecov-html 0.10.2
Fetching tins 1.20.2
Installing json 2.1.0 with native extensions
Installing simplecov-html 0.10.2
Fetching thor 0.19.4
Installing tins 1.20.2
Installing thor 0.19.4
Fetching diff-lcs 1.3
Fetching hpricot 0.8.6
Installing diff-lcs 1.3
Fetching jaro_winkler 1.5.2
Installing hpricot 0.8.6 with native extensions
Installing jaro_winkler 1.5.2 with native extensions
Fetching mustache 1.1.0
Fetching parallel 1.13.0
Installing parallel 1.13.0
Fetching powerpack 0.1.2
Installing mustache 1.1.0
Fetching rainbow 3.0.0
Installing powerpack 0.1.2
Fetching rdiscount 2.2.0.1
Fetching rspec-support 3.8.0
Installing rainbow 3.0.0
Fetching ruby-progressbar 1.10.0
Installing rspec-support 3.8.0
Installing ruby-progressbar 1.10.0
Fetching unicode-display_width 1.4.1
Fetching parser 2.6.0.0
Installing rdiscount 2.2.0.1 with native extensions
Installing unicode-display_width 1.4.1
Fetching term-ansicolor 1.7.1
Installing term-ansicolor 1.7.1
Installing parser 2.6.0.0
Fetching parallel_tests 2.27.1
Installing parallel_tests 2.27.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/parser
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r
./siteconf20190121-49092-1228dr2.rb extconf.rb
checking for rb_enc_raise() in ruby.h... *** 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
	--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=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:535:in
`block in try_link0'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/tmpdir.rb:89:in
`mktmpdir'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:532:in
`try_link0'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:556:in
`try_link'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:765:in
`try_func'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1051:in
`block in have_func'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in
`block in checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block (2 levels) in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in
`postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in
`checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1050:in
`have_func'
	from extconf.rb:4:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0
for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/gem_make.out

An error occurred while installing json (2.1.0), and Bundler cannot
continue.
Make sure that `gem install json -v '2.1.0' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  coveralls was resolved to 0.8.22, which depends on
    simplecov was resolved to 0.16.1, which depends on
      json


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6/ext/fast_xs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r
./siteconf20190121-49092-s98url.rb extconf.rb
checking for stdio.h... *** 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
	--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=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in
`block in try_compile'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:524:in
`with_werror'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in
`try_compile'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1091:in
`block in have_header'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in
`block in checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block (2 levels) in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in
`postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in
`checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1090:in
`have_header'
	from extconf.rb:2:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6
for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/gem_make.out

An error occurred while installing hpricot (0.8.6), and Bundler cannot
continue.
Make sure that `gem install hpricot -v '0.8.6' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    hpricot
Error: cannot load such file -- rubocop
Please report this bug:
  https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/style.rb:21:in `check_style_impl'
/usr/local/Homebrew/Library/Homebrew/style.rb:14:in `check_style_json'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:149:in `audit'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'

@JuPlutonic
Copy link
Contributor

@susemeee please explain are the HOMEBREW_DEVELOPER and the HOMEBREW_RUBY_PATH set to the same path /usr/bin/ruby?

@susemeee
Copy link

susemeee commented Jan 23, 2019

@JuPlutonic Not exactly, instead I put ruby 2.6.0 pulled from rvm and set HOMEBREW_RUBY_PATH to the ruby (from rvm) path.

When I did not put HOMEBREW_DEVELOPER flag to env, Homebrew keeps using its portable-ruby (I don't know exactly why) so I simply put HOMEBREW_DEVELOPER=true.

I think there is some incompatibility between macOS' default Ruby (and probably portable-ruby from Homebrew's) and its native extensions.

@MikeMcQuaid
Copy link
Member

I think there is some incompatibility between macOS' default Ruby (and probably portable-ruby from Homebrew's) and its native extensions.

Yes, see: Homebrew/homebrew-cask#52775 (comment) https://openradar.appspot.com/46465917. Apple are aware of it and are working on a fix. I'm not sure why this doesn't affect everyone.

@claui claui removed their assignment Jan 23, 2019
@MikeMcQuaid MikeMcQuaid added the in progress Maintainers are working on this label Jan 29, 2019
@AliSoftware
Copy link

AliSoftware commented Jan 29, 2019

I just observed the bug while I was trying to push a new version of SwiftGen… from my machine which is still on High Sierra… so this definitively isn't only a Mojave bug 😢

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G3025
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
$ uname -mrsv 
Darwin 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64
$ stat /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h
16777220 8618694621 -rw-r--r-- 1 root wheel 0 10832 "Nov  7 10:03:18 2018" "Oct  7 04:47:09 2017" "Oct 31 21:53:27 2018" "Oct  7 04:47:09 2017" 4194304 0 0x80020 /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h
brew config
$ brew config
HOMEBREW_VERSION: 1.9.2-7-gbd09f93
ORIGIN: https://github.com/Homebrew/brew
HEAD: bd09f934fce29ce9554f452bd7f812dc65f14e4b
Last commit: 2 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a6d37cf0856a1adaba4f7fb9ec509d4da9f12156
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/ohalligon/Library/Logs/Homebrew
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode-10.1.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 10.0.2
macOS: 10.13.6-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1 => /Applications/Xcode-10.1.app/Contents/Developer
brew audit swiftgen
$ brew audit swiftgen                                    
Fetching gem metadata from https://rubygems.org/........
Using ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Using docile 1.3.1
Using simplecov-html 0.10.2
Using tins 1.20.2
Using thor 0.19.4
Using diff-lcs 1.3
Fetching hpricot 0.8.6
Using jaro_winkler 1.5.2
Using mustache 1.1.0
Using parallel 1.12.1
Using powerpack 0.1.2
Using rainbow 3.0.0
Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Installing json 2.1.0 with native extensions
Installing hpricot 0.8.6 with native extensions
Using rspec-support 3.8.0
Using ruby-progressbar 1.10.0
Using unicode-display_width 1.4.1
Using parser 2.5.3.0
Using term-ansicolor 1.7.0
Using parallel_tests 2.27.1
Using rspec-core 3.8.0
Using rspec-expectations 3.8.2
Using rspec-mocks 3.8.0
Using rubocop 0.61.1
Using rspec 3.8.0
Using rspec-its 1.2.0
Using rspec-retry 0.6.1
Using rspec-wait 0.0.9
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/parser
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r ./siteconf20190129-87067-1ka29kg.rb extconf.rb
checking for rb_enc_raise() in ruby.h... *** 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
	--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=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:535:in `block in try_link0'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:532:in `try_link0'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
	from extconf.rb:4:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/gem_make.out

An error occurred while installing json (2.1.0), and Bundler cannot continue.
Make sure that `gem install json -v '2.1.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  coveralls was resolved to 0.8.22, which depends on
    simplecov was resolved to 0.16.1, which depends on
      json


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6/ext/fast_xs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r ./siteconf20190129-87067-etp61c.rb extconf.rb
checking for stdio.h... *** 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
	--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=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:524:in `with_werror'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
	from extconf.rb:2:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/gem_make.out

An error occurred while installing hpricot (0.8.6), and Bundler cannot continue.
Make sure that `gem install hpricot -v '0.8.6' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    hpricot


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rdiscount-2.2.0.1/ext
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r ./siteconf20190129-87067-mpu8u7.rb extconf.rb
checking for random()... *** 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
	--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=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
	--with-rdiscount-dir
	--without-rdiscount-dir
	--with-rdiscount-include
	--without-rdiscount-include=${rdiscount-dir}/include
	--with-rdiscount-lib
	--without-rdiscount-lib=${rdiscount-dir}/lib
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:535:in `block in try_link0'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:532:in `try_link0'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
	from extconf.rb:5:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/rdiscount-2.2.0.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rdiscount-2.2.0.1 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/rdiscount-2.2.0.1/gem_make.out

An error occurred while installing rdiscount (2.2.0.1), and Bundler cannot continue.
Make sure that `gem install rdiscount -v '2.2.0.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    rdiscount

FWIW, I tried with HOMEBREW_FORCE_VENDOR_RUBY=1 brew audit swiftgen too, but got the same errors.

@AliSoftware
Copy link

AliSoftware commented Jan 29, 2019

Note: Realizing Xcode 10.1 contained the MacOS10.14 SDK, I decided to switch my xcode-select from Xcode 10.1 to 9.4.1 (while still on the same machine with the same OS)… and the problem disappears 🤔 (after the brew audit I had to switch back to Xcode 10.1 to brew install swiftgen though as our formula require Xcode 10…)

@jcpoyser
Copy link

jcpoyser commented Feb 2, 2019

This is a Mojave bug:

Homebrew/homebrew-cask#52775 (comment)

It's not just a Mojave bug - I experience the same issue in High Sierra 10.13.6

@MikeMcQuaid
Copy link
Member

It’s technically Xcode 10 so yes it can affect High Sierra.

@VonUniGE
Copy link
Contributor

My current workaround:

rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/
brew vendor-install ruby

Using brew vendor-install ruby alone is not enough.

@JuPlutonic
Copy link
Contributor

@VonUniGE, thanks a lot. Only yours solution works and it is cross platform.. I got(Linuxbrew / Ubuntu 18.10).
The difference in Linux is rm -rf /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/.

@mfriedenhagen
Copy link

rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/
brew vendor-install ruby

@VonUniGE, I just tried that but brew audit (or brew style) keep complaining about the missing ruby/config.h file when trying to compile the JSON module. Did you set an environment variable to use the Vendor Ruby as well?

@scpeters
Copy link
Member

@mfriedenhagen I've had success with HOMEBREW_FORCE_VENDOR_RUBY=1

@jamesdbloom
Copy link

jamesdbloom commented Jun 23, 2019

@MikeMcQuaid I'm sorry but I thought as per the previous 47 similar comments it was helpful to provide extra information so that the source of the issue could be more clearly understood. Clearly my comment has upset you as you have not request any of the previous 47 identical comments to post on discus. I'm sorry if I have upset you.

@MikeMcQuaid
Copy link
Member

@jamesdbloom You haven't upset me, thanks for the apology anyway though. The cause of the issue is understood, it's on Apple's end. Suggested workarounds here are the only additional useful contributions here, thanks.

@dawidd6
Copy link
Member

dawidd6 commented Sep 10, 2019

Just for future reference if someone (like me) would encounter this issue:
installing zlib1g-dev package via apt fixes this.

@MikeMcQuaid MikeMcQuaid changed the title Homebrew development commands fail to install some gems Homebrew development commands fail to install some gems on Mojave with Xcode Sep 30, 2019
@MikeMcQuaid MikeMcQuaid changed the title Homebrew development commands fail to install some gems on Mojave with Xcode Homebrew development commands fail to install some gems on Mojave with Xcode >10 Sep 30, 2019
@MikeMcQuaid MikeMcQuaid changed the title Homebrew development commands fail to install some gems on Mojave with Xcode >10 Homebrew development commands fail to install some gems on Xcode >10 Sep 30, 2019
@MikeMcQuaid MikeMcQuaid changed the title Homebrew development commands fail to install some gems on Xcode >10 Homebrew development commands fail to install some gems on Mojave on Xcode >10 Sep 30, 2019
@daxmc99
Copy link

daxmc99 commented Oct 2, 2019

@mcdado solution worked for me

This solved it for me:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I don't have Xcode installed, I only had the CLI Tools.

@B1-Bloom
Copy link

B1-Bloom commented Oct 19, 2019

I've dealt with a similar issue if I'm understanding correctly. I resolved it with the current 2.6.3 with:
ln -s /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/bin ~/.gem/ruby/2.6.0/bin

When the portable-ruby version was on 2.3.0 I think I only needed to run their gem update:
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/gem update --system

@Bo98
Copy link
Member

Bo98 commented Mar 30, 2020

Has there been much reports of this now that we have updated vendored Ruby to 2.6.3 and therefore avoid using system Ruby on Mojave? It, in theory, shouldn't be possible now. If it's still trying to find 2.3 headers then it's clearly not using 2.6.3 properly.

I have not been able to reproduce this with brew's Ruby in the last few months on my Mojave install. That said, brew tests has been broken for me - though with a different error.

@MikeMcQuaid
Copy link
Member

Yeh, gonna close this out. Comment here if you're still affected!

@claui
Copy link
Contributor

claui commented Mar 31, 2020

I’m still affected by this. I’ve been unable to run brew cask style/brew style for a while. Sometimes it self-heals intermittently for a few months, then it breaks again.

$ brew cask style claui/cask-games/gog-truberbrook
Command output

Ignoring bigdecimal-2.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 2.0.0
Ignoring bigdecimal-1.4.4 because its extensions are not built. Try: gem pristine bigdecimal --version 1.4.4
Ignoring bigdecimal-1.4.3 because its extensions are not built. Try: gem pristine bigdecimal --version 1.4.3
Ignoring bigdecimal-1.4.2 because its extensions are not built. Try: gem pristine bigdecimal --version 1.4.2
Ignoring date-3.0.0 because its extensions are not built. Try: gem pristine date --version 3.0.0
Ignoring date-2.0.0 because its extensions are not built. Try: gem pristine date --version 2.0.0
Ignoring dbm-1.1.0 because its extensions are not built. Try: gem pristine dbm --version 1.1.0
Ignoring etc-1.1.0 because its extensions are not built. Try: gem pristine etc --version 1.1.0
Ignoring gdbm-2.1.0 because its extensions are not built. Try: gem pristine gdbm --version 2.1.0
Ignoring io-console-0.5.6 because its extensions are not built. Try: gem pristine io-console --version 0.5.6
Ignoring io-console-0.5.5 because its extensions are not built. Try: gem pristine io-console --version 0.5.5
Ignoring io-console-0.5.4 because its extensions are not built. Try: gem pristine io-console --version 0.5.4
Ignoring io-console-0.5.3 because its extensions are not built. Try: gem pristine io-console --version 0.5.3
Ignoring io-console-0.5.2 because its extensions are not built. Try: gem pristine io-console --version 0.5.2
Ignoring io-console-0.5.0 because its extensions are not built. Try: gem pristine io-console --version 0.5.0
Ignoring io-console-0.4.9 because its extensions are not built. Try: gem pristine io-console --version 0.4.9
Ignoring io-console-0.4.8 because its extensions are not built. Try: gem pristine io-console --version 0.4.8
Ignoring json-2.3.0 because its extensions are not built. Try: gem pristine json --version 2.3.0
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
Ignoring stringio-0.1.0 because its extensions are not built. Try: gem pristine stringio --version 0.1.0
Ignoring strscan-1.0.3 because its extensions are not built. Try: gem pristine strscan --version 1.0.3
Ignoring zlib-1.1.0 because its extensions are not built. Try: gem pristine zlib --version 1.1.0
/Users/claudia/.gem/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
Ignoring jaro_winkler-1.5.3 because its extensions are not built. Try: gem pristine jaro_winkler --version 1.5.3
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
Ignoring nokogiri-1.10.4 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.4
Fetching gem metadata from https://rubygems.org/.........
Using concurrent-ruby 1.1.6
Using minitest 5.14.0
Using thread_safe 0.3.6
Using zeitwerk 2.3.0
Using ast 2.4.0
Using bundler 1.17.3
Using connection_pool 2.2.2
Using json 2.3.0
Using docile 1.3.2
Using simplecov-html 0.10.2
Using sync 0.5.0
Using thor 1.0.1
Using diff-lcs 1.3
Fetching unf_ext 0.0.7.7
Using hpricot 0.8.6
Using jaro_winkler 1.5.4
Using mime-types-data 3.2019.1009
Using net-http-digest_auth 1.4.1
Using mini_portile2 2.4.0
Using ntlm-http 0.1.1
Using webrobots 0.1.2
Using mustache 1.1.1
Using parallel 1.19.1
Using plist 3.5.0
Using rainbow 3.0.0
Using rexml 3.2.4
Using rspec-support 3.9.2
Using ruby-progressbar 1.10.1
Using unicode-display_width 1.6.1
Using ruby-macho 2.2.0
Using i18n 1.8.2
Using tzinfo 1.2.6
Using simplecov 0.16.1
Using tins 1.24.1
Using rdiscount 2.2.0.1
Using net-http-persistent 3.1.0
Using mime-types 3.3.1
Fetching nokogiri 1.10.9
Using parallel_tests 2.32.0
Using parser 2.7.0.5
Using rspec-core 3.9.1
Using rspec-expectations 3.9.1
Using rspec-mocks 3.9.1
Using activesupport 6.0.2.2
Using term-ansicolor 1.7.1
Using ronn 0.7.3
Using rspec-retry 0.6.2
Using rubocop 0.80.1
Using rspec 3.9.0
Using rspec-its 1.3.0
Using coveralls 0.8.23
Using rubocop-performance 1.5.2
Using rubocop-rspec 1.38.1
Using rspec-wait 0.0.9
Installing unf_ext 0.0.7.7 with native extensions
Installing nokogiri 1.10.9 with native extensions
Using unf 0.1.4
Using domain_name 0.5.20190701
Using http-cookie 1.0.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri
/usr/local/var/rbenv/versions/2.6.5/bin/ruby -I /usr/local/var/rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r
./siteconf20200331-8731-13ypgbf.rb extconf.rb
checking if the C compiler accepts  -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
Ignoring jaro_winkler-1.5.3 because its extensions are not built. Try: gem pristine jaro_winkler --version 1.5.3
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
Ignoring nokogiri-1.10.4 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.4
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
	- 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

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.10.tar.gz into tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10... OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0002-Remove-script-macro-support.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch...
OK
Running 'configure' for libxml2 2.9.10... ERROR, review
'/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri/tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10/configure.log'
to see what happened. Last lines are:
========================================================================
config.status: creating doc/examples/Makefile
config.status: creating doc/devhelp/Makefile
config.status: creating example/Makefile
config.status: creating python/Makefile
config.status: creating python/tests/Makefile
config.status: creating xstc/Makefile
config.status: creating include/libxml/xmlversion.h
config.status: creating libxml-2.0.pc
config.status: creating libxml-2.0-uninstalled.pc
config.status: creating libxml2-config.cmake
config.status: creating python/setup.py
config.status: creating xml2-config
config.status: creating config.h
config.status: executing depfiles commands
config.status: error: in
`/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri/tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10/libxml2-2.9.10':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details
========================================================================
*** 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=/usr/local/var/rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
	--help
	--clean
	--use-system-libraries
	--enable-static
	--disable-static
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--enable-cross-build
	--disable-cross-build
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:402:in `block
in execute': Failed to complete configure task (RuntimeError)
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in
`chdir'
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in
`execute'
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:110:in
`configure'
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:153:in
`cook'
	from extconf.rb:365:in `block (2 levels) in process_recipe'
	from extconf.rb:257:in `block in chdir_for_build'
	from extconf.rb:256:in `chdir'
	from extconf.rb:256:in `chdir_for_build'
	from extconf.rb:364:in `block in process_recipe'
	from extconf.rb:262:in `tap'
	from extconf.rb:262:in `process_recipe'
	from extconf.rb:557:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9 for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.9/gem_make.out

An error occurred while installing nokogiri (1.10.9), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.9' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mechanize was resolved to 2.7.6, which depends on
    nokogiri
Error: failed to run `/Users/claudia/.gem/ruby/2.6.0/bin/bundle install`!

@Bo98
Copy link
Member

Bo98 commented Mar 31, 2020

That's a bit different than the original error which was about finding Ruby headers ('ruby/config.h' file not found) which is well-known problem with Mojave's system gem.

For you, it looks like it is using the Ruby in rbenv. I'm not sure if that's the cause or not.

Is there a config.log (not configure.log) in or around /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri/tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10/libxml2-2.9.10?

Does /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.9/mkmf.log provide anything that isn't already above?

@MikeMcQuaid
Copy link
Member

For you, it looks like it is using the Ruby in rbenv. I'm not sure if that's the cause or not.

Yes, that will be the problem.

@lock lock bot added the outdated PR was locked due to age label May 5, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress Maintainers are working on this outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests