ERROR: Failed to build gem native extension on rubygem installation - ruby

While trying to do "bundle install", I receive error message below
environment = OSX 10.9.4, rbenv 0.4.0,
ruby 2.1.2,
Homebrew 0.9.5
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/hirotakagotanda/.rbenv/versions/2.1.2/bin/ruby extconf.rb
*** 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/hirotakagotanda/.rbenv/versions/2.1.2/bin/ruby
/Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory # rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
from /Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
from /Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
from /Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
from /Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
from extconf.rb:83:in `block in <main>'
from extconf.rb:82:in `each'
from extconf.rb:82:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-1.6.6 for inspection.
Results logged to /Users/hirotakagotanda/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.6/gem_make.out
An error occurred while installing debugger (1.6.6), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.6'` succeeds before bundling.
Could anyone please provide me solution, I have been misfortunate to find out any...

This is likely a problem with the Xcode Command Line Tools. There are a number of steps needed to get this right.
This question Installing Ruby Debug IDE Gem provides one example.

I ran into the same issue and solved it by agreeing to xcode's license (it seems to happen after an update and you haven't yet agreed to the update)
Just run xcodebuild -license from the command line
Found the answer thanks to this question

Neither of the above comments helped me. Changing to ruby 2.1.1 of below allowed me to bundle without issue.
rbenv local 2.1.1
bundle install
using ruby 2.1.2, it breaks in the same place

Related

Installing rbtrace 0.4.14 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension

This happened to me several times while trying to install Discourse:
Cannot install rbtrace with native extensions.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
*** 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/setoelka/.rbenv/versions/2.7.3/bin/$(RUBY_BASE_NAME)
extconf.rb:6:in `sys': make install failed, please report to https://github.com/tmm1/rbtrace/issues (RuntimeError)
from extconf.rb:43:in `block (2 levels) in <main>'
from extconf.rb:34:in `chdir'
from extconf.rb:34:in `block in <main>'
from extconf.rb:30:in `chdir'
from extconf.rb:30:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/setoelka/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/rbtrace-0.4.14/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/setoelka/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/rbtrace-0.4.14 for inspection.
Results logged to /Users/setoelka/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/rbtrace-0.4.14/gem_make.out
An error occurred while installing rbtrace (0.4.14), and Bundler cannot continue.
Make sure that `gem install rbtrace -v '0.4.14' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rbtrace
Does anyone know about the problem? I tried running:
gem install rbtrace -v '0.4.14' --source 'http://rubygems.org/' -- --with-cflags=-Wno-implicit-function-declaration
No luck so far.
I solved this problem by myself by looking at the mkmf.log content.
TLDR;
Use the selected Xcode with standar naming, i.e, Xcode.app.
It turned out that Ruby will compile the gem using the compiler from the default Xcode. I have multiple version of Xcodes and use the xcode-select to switch between them.
The thing is, the ruby setup will always looking for the default Xcode.app naming. If you name your selected Xcode something else, you'll get this error.

How to install Nokogiri on Manjaro

I installed, and reinstalled, Nokogiri multiple times, with and without sudo, and when running bundle install I get in my console:
Fetching nokogiri 1.10.7
Installing nokogiri 1.10.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/april/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.10.7/ext/nokogiri
/home/april/.rvm/rubies/ruby-2.5.0/bin/ruby -I /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0 -r
./siteconf20200331-50466-133fhom.rb extconf.rb
checking if the C compiler accepts ... *** 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=/home/april/.rvm/rubies/ruby-2.5.0/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an
executable file. (RuntimeError)
You have to install development tools first.
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /home/april/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/april/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/april/.rvm/gems/ruby-2.5.0/gems/nokogiri-1.10.7 for inspection.
Results logged to /home/april/.rvm/gems/ruby-2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.10.7/gem_make.out
An error occurred while installing nokogiri (1.10.7), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.7'` succeeds before bundling.
In Gemfile:
activeadmin_addons was resolved to 1.6.0, which depends on
xdan-datetimepicker-rails was resolved to 2.5.4, which depends on
rails was resolved to 5.1.5, which depends on
actioncable was resolved to 5.1.5, which depends on
actionpack was resolved to 5.1.5, which depends on
actionview was resolved to 5.1.5, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
I also tried re-installing libxml2 and libxslt and I still keep running into this issue.

Unable to install rmagick on mojave

Went thru many blogs in stackoverflow inorder to install rmagick but didnt find a solution. Any help is much appreciated.
Tried using uninstalling and reinstalling imagemagick. Flow some links like Install rmagick
Here is the output
sudo gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/rmagick-
2.16.0/ext/RMagick
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20181206-50407-46eq96.rb extconf.rb
checking for xcrun... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >=
6.9.0)... no
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
extconf.rb:104:in ``': No such file or directory - MagickWand-config
(Errno::ENOENT)
from extconf.rb:104:in `configure_compile_options'
from extconf.rb:16:in `initialize'
from extconf.rb:548:in `new'
from extconf.rb:548:in `<main>'
To see why this extension failed to compile, please check the mkmf.log
which can be found here:
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/rmagick-2.16.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/Library/Ruby/Gems/2.3.0/gems/rmagick-2.16.0 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-
darwin-18/2.3.0/rmagick-2.16.0/gem_make.out
If you've installed Imagemagick per the instructions in your link, your shell may missing the path to the binaries. You can test by running a console command:
which MagickWand-config
If it returns a path (likely /usr/local/bin/MagickWand-config) your path is probably fine. If it returns MagickWand-config not found you should be able to type export PATH=/usr/local/bin:$PATH in your console.
If your path wasn't correct before, after running the export command you can re-run the which MagickWand-config command to confirm it's in your path. Then try to gem install rmagick again.
I was able to install rmagick on Mojave following the link you posted.
If this did fix your issue you'll also want to add the export command I noted in your ~/.bash_profile or ~/.zsh_profile file so that path is prepended in every terminal window (if it's not there already)

Ruby and RubyDev under Chocolately on Windows

I have installer ruby 2.3.1 ruby.devkit 4.5.2.20120101 from the chocolately repostory on windows 10
then i have modified conf.yml and run:
PS C:\tools\DevKit> ruby dk.rb install --force
[WARN] Updating (with backup) existing gem override for 'C:/tools/ruby23'
[WARN] Updating (with backup) DevKit helper library for 'C:/tools/ruby23'
All seem to me ok, but when I try to update gems, some of them show the following errors:
PS C:\tools\DevKit> gem update
Updating installed gems
Updating bigdecimal
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing bigdecimal:
ERROR: Failed to build gem native extension.
current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bigdecimal-1.3.0/ext/bigdecimal
C:/tools/ruby23/bin/ruby.exe -r ./siteconf20170106-4004-rogg3v.rb extconf.rb
checking for labs() in stdlib.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
--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=C:/tools/ruby23/bin/$(RUBY_BASE_NAME)
C:/tools/ruby23/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 C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
from extconf.rb:6:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/bigdecimal-1.3.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/bigdecimal-1.3.0 for inspection.
Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/bigdecimal-1.3.0/gem_make.out
Updating did_you_mean
ERROR: Error installing did_you_mean:
did_you_mean requires Ruby version >= 2.4.0dev.
Updating io-console
Building native extensions. This could take a while...
ERROR: Error installing io-console:
ERROR: Failed to build gem native extension.
current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/io-console-0.4.6
C:/tools/ruby23/bin/ruby.exe -r ./siteconf20170106-4004-impy5k.rb extconf.rb
*** 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=C:/tools/ruby23/bin/$(RUBY_BASE_NAME)
C:/tools/ruby23/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 C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:524:in `with_werror'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:835:in `macro_defined?'
from extconf.rb:7:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/io-console-0.4.6/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/io-console-0.4.6 for inspection.
Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/io-console-0.4.6/gem_make.out
Updating json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/json-2.0.2/ext/json/ext/generator
C:/tools/ruby23/bin/ruby.exe -r ./siteconf20170106-4004-dmzeq3.rb extconf.rb
creating Makefile
current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/json-2.0.2/ext/json/ext/generator
make "DESTDIR=" clean
current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/json-2.0.2/ext/json/ext/generator
make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [generator.o] Error 127
make failed, exit code 2
Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/json-2.0.2 for inspection.
Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/json-2.0.2/gem_make.out
Updating psych
Building native extensions. This could take a while...
ERROR: Error installing psych:
ERROR: Failed to build gem native extension.
current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/psych-2.2.2/ext/psych
C:/tools/ruby23/bin/ruby.exe -r ./siteconf20170106-4004-1rx9fhh.rb extconf.rb
checking for yaml.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
--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=C:/tools/ruby23/bin/$(RUBY_BASE_NAME)
--with-libyaml-dir
--without-libyaml-dir
--with-libyaml-include
--without-libyaml-include=${libyaml-dir}/include
--with-libyaml-lib
--without-libyaml-lib=${libyaml-dir}/lib
--enable-bundled-libyaml
--disable-bundled-libyaml
C:/tools/ruby23/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 C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header'
from extconf.rb:10:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/psych-2.2.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/psych-2.2.2 for inspection.
Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/psych-2.2.2/gem_make.out
Gems updated: bigdecimal did_you_mean io-console json psych
i realy can't understand what is happen, any idea?
tl;dr - you should install ruby2.devkit instead.
In https://stackoverflow.com/a/41511890/18475 answer, it says that the ruby.devkit package is out of date. It's not, it just applies to a different Ruby.
Incorrect Package
You maybe missed this from https://chocolatey.org/packages/ruby.devkit:
As opposed to Ruby v2 DevKit (https://chocolatey.org/packages/ruby2.devkit):
You installed the incorrect package - https://chocolatey.org/packages/ruby2.devkit is the one you are looking for.
The compiler changed for Ruby v2+ for Ruby on Windows, which means you need to use the proper compilers. That DevKit is in the ruby2.devkit package.
Don't Forget to Refresh Your Environment
If you are using Chocolatey, you get refreshenv as a command you can call in cmd.exe or powershell.exe (With PowerShell, be sure you have tab completion in your profile so that the proper refreshenv is available).
Otherwise you will need to close and reopen your shell for the updated PATHs to happen.
More Details
Head out to http://rubyinstaller.org/downloads/:
More Fun With Ruby
Here's a gist that does a complete Ruby stack setup: https://gist.github.com/ferventcoder/947479688d930e28d632
It's a bit outdated, so here is an update (PowerShell):
# https://github.com/chocolatey/choco/wiki/CommandsReference#how-to-pass-options--switches
# Powershell specific argument passing
# You must be on the latest beta of chocolatey for this to work properly (redownload files)
choco upgrade chocolatey -y
$originalPath = $env:PATH
choco install ruby --version 2.1.8 -my -x86 --install-arguments '/verysilent /dir=""c:\tools\ruby21"" /tasks=""assocfiles""' --override-arguments
choco install ruby --version 2.1.8 -fmy --install-arguments '/verysilent /dir=""c:\tools\ruby21-x64"" /tasks=""assocfiles""' --override-arguments
choco install ruby --version 2.3.1 -my -x86 --install-arguments '/verysilent /dir=""c:\tools\ruby23"" /tasks=""assocfiles""' --override-arguments
choco install ruby --version 2.3.1 -fmy --install-arguments '/verysilent /dir=""c:\tools\ruby23-x64"" /tasks=""assocfiles,modpath""' --override-arguments
Write-Output "Attempting Good DevKit2 Installations"
# DevKit for Ruby 2.x x64
$env:PATH=$originalPath
choco install ruby2.devkit -y
Move-Item c:\tools\DevKit2 C:\tools\DevKit2-x64 -Force -EA Continue
# DevKit for Ruby 2.x x86
choco install ruby2.devkit -y -x86 -f
Write-Output "Fixing DevKit Installations"
#"
---
- c:/tools/ruby21
- c:/tools/ruby23
"# | Out-File c:\tools\DevKit2\config.yml -Force -Encoding UTF8
pushd c:\tools\DevKit2
ruby dk.rb install -f
popd
#"
---
- c:/tools/ruby21-x64
- c:/tools/ruby23-x64
"# | Out-File c:\tools\DevKit2-x64\config.yml -Force -Encoding UTF8
pushd c:\tools\DevKit2-x64
ruby dk.rb install -f
popd
choco install pik -y
cmd /c C:\tools\pik\pik.bat add c:\tools\ruby21\bin
cmd /c C:\tools\pik\pik.bat add c:\tools\ruby21-x64\bin
cmd /c C:\tools\pik\pik.bat add c:\tools\ruby23\bin
cmd /c C:\tools\pik\pik.bat add c:\tools\ruby23-x64\bin
The important part in the error messages is:
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
In order to install compiled gems, you need a compiler installed. For Windows, you can install the Ruby DeveloperKit.
While you have it installed apparently, it doesn't seem to be recognized. This can have one of various reasons, the most common being the devkit not matching your ruby version or issues with the %PATH.

Can't install charlock holmes gem, libicu-devel installed

I am trying to install charlock holmes, nevertheless, I keep getting an error:
[root#hugovm gitlab]# gem install charlock_holmes --version '0.6.9.4'
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
-- tar zxvf file-5.08.tar.gz
-- ./configure --prefix=/usr/local/share/gems/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-static --with-pic
-- patch -p0 < ../file-soft-check.patch
*** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-icu-dir
--without-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/
--with-icui18nlib
--without-icui18nlib
--with-icui18nlib
--without-icui18nlib
extconf.rb:7:in `sys': patch -p0 < ../file-soft-check.patch failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
from extconf.rb:61:in `block (2 levels) in <main>'
from extconf.rb:59:in `chdir'
from extconf.rb:59:in `block in <main>'
from extconf.rb:55:in `chdir'
from extconf.rb:55:in `<main>'
Gem files will remain installed in /usr/local/share/gems/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to /usr/local/share/gems/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/gem_make.out
I already installed libicu-devel.
Thanks
I had the exact same issue today. Tried to install gitlab on a clean fedora machine.
For me, a line in /usr/local/share/gems/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/gem_make.out pointed to mkmf.log, which is in the same directory as above log file.
There it said "patch: command not found"
sudo yum install patch
In you output I can read:
extconf.rb:7:in `sys': patch -p0 < ../file-soft-check.patch failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
So it all points to a bug. I suppose it is a good idea follow the output and created an issue there, explaining what you are trying to do and giving details of your environment.
ruby-devel is missing
yum install ruby-devel
and you'll be set :)

Resources