I am trying to install hpricot using the command:
>gem install hpricot -v 0.8.2
Building native extensions. This could take a while...
ERROR: Error installing hpricot:
ERROR: Failed to build gem native extension.
C:/Ruby19/bin/ruby.exe 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
--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:/Ruby19/bin/ruby
C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:362:in try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:431:intry_cpp'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:809:in block in have_header'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:668:inblock in checking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in block (2 levels) in postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:inopen'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:274:in block in postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:248:inopen'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:270:in postpone'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:667:inchecking_for'
from C:/Ruby19/lib/ruby/1.9.1/mkmf.rb:808:in have_header'
from extconf.rb:2:in'
Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out
it mentions I need to install "development tools" but I have no idea what that refers to. Any suggestions?
Try:
gem install hpricot --platform=mswin32
Install the devkit at rubyinstaller.org/downloads
Execute below command and it works:
gem install hpricot --platform=mswin32
An additional note that others may find useful, from my recent attempt to install on Windows using the Ruby devkit:
To install the devkit, you extract the bin and devkit directories to your Ruby directory which will place a few files in your Ruby bin and a devkit directory in your Ruby directory. Then, per the instructions, you set the proper location for mingw in the fstab file.
In my case, some gems, namely Hpricot and Ruby-Debug19, would not install on my system even with the devkit installed properly because of an error creating the makefile. I ended up installing the latest version of mingw separately from SourceForge, then changed the fstab file within the "ruby19/devkit/msys/1.0.11/etc" directory to point to the directory where I installed mingw. Both gems then installed correctly.
Execute the following command:
gem install hpricot
Related
Use root user installed rubygems.
# yum install rubygems -y
When check ruby's version, got
# ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
Gem's version:
# gem -v
2.7.6.3
When install a gem, got
# gem install fluent-plugin-kinesis
Building native extensions. This could take a while...
ERROR: Error installing fluent-plugin-kinesis:
ERROR: Failed to build gem native extension.
current directory: /usr/local/share/gems/gems/msgpack-1.4.2/ext/msgpack
/usr/bin/ruby -r ./siteconf20210825-20925-17fyw57.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /usr/local/share/gems/gems/msgpack-1.4.2 for inspection.
Results logged to /usr/local/lib64/gems/ruby/msgpack-1.4.2/gem_make.out
Should I install a high version ruby? It's the default one on the system.
update
I installed ruby-devel
# yum install ruby-devel.x86_64
Run install fluent-plugin-kinesis gem again
# gem install fluent-plugin-kinesis
Building native extensions. This could take a while...
ERROR: Error installing fluent-plugin-kinesis:
ERROR: Failed to build gem native extension.
current directory: /usr/local/share/gems/gems/msgpack-1.4.2/ext/msgpack
/usr/bin/ruby -r ./siteconf20210826-11878-18i9eps.rb extconf.rb
checking for ruby/st.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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:590:in `try_cpp'
from /usr/share/ruby/mkmf.rb:1098:in `block in have_header'
from /usr/share/ruby/mkmf.rb:948:in `block in checking_for'
from /usr/share/ruby/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:350:in `block in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:346:in `postpone'
from /usr/share/ruby/mkmf.rb:947:in `checking_for'
from /usr/share/ruby/mkmf.rb:1097:in `have_header'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib64/gems/ruby/msgpack-1.4.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/share/gems/gems/msgpack-1.4.2 for inspection.
Results logged to /usr/local/lib64/gems/ruby/msgpack-1.4.2/gem_make.out
For other gems works well.
Take a look at the docs or this answer.
Install Ruby >= 2.4 on your local environment. In addition, install ruby-dev package via Package Manager to build native extension gems.
I believe in CentOS ruby-dev equivalent is ruby-devel. You can confirm it by running yum search ruby-dev
You'll find 2 packages, one i686 and another x86_64. You can find which one you need by running lscpu | grep Arch.
Then simply download the package, and rerun gem install
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.
I have a remote linux server, it does not have internet and its behind firewall. Its does not have gcc compiler. So I cant install or compile .
The linux server has got the rvm installed with ruby 1.9.3
Usually , I would install the gem on my local Mac OSX and then copy the gems to the linux server i.e ( xxxx.gem file from cache directory and xxx folder from gem directory of the ruby). So far it has been working fine. As part of the new test, I installed sqlite3 gem and copied its .gem file to the linux server and did a gem install sqlite on the linux server. It did work and got the below error
gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
checking for sqlite3.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=/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
/ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /ngs/app/athenat/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:34:in `<main>'
Gem files will remain installed in /ngs/app/athenat/.rvm/gems/ruby-1.9.3-p374#11.4.0-1/gems/sqlite3-1.3.8 for inspection.
Results logged to /ngs/app/athenat/.rvm/gems/ruby-1.9.3-p374#11.4.0-1/gems/sqlite3-1.3.8/ext/sqlite3/gem_make.out
I googled and saw many have suggested to install apt-get install libsqlite3-dev. I can't do this on my remote linux server.
Can anyone please suggest how to resolve this.
I followed few of the suggestion posted in the below post but it did not work.
Problem installing sqlite3-ruby!
sqlite3 gem fails to install
Not having a compiler is going to make this sort of thing nearly impossible.
You can't just compile for OS X and sling those binaries over to Linux. They're not the same format.
You may be able to create an environment compatible with your Linux target using a virtual environment in VMWare Fusion or VirtualBox, such as when using Vagrant, to compile for your target OS and architecture and them ship those binaries over. This is usually a last resort, as you will have to link against exactly the same libraries you have available on the remote system. To do this correctly could take a lot of time.
I am trying to install ruby on rails (v4.0) using ruby installer. It is throwing me this error. I am brand new to RoR and some websites told me to install devkit. I have done that. I ran gem install thin
C:\Users\shashid\Downloads>gem install rails
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/RubyRails/bin/ruby.exe 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:/RubyRails/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to gene
rate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from C:/RubyRails/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:22:in `<main>'
Gem files will remain installed in C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-
1.1.10 for inspection.
Results logged to C:/RubyRails/lib/ruby/gems/2.0.0/gems/atomic-1.1.10/ext/gem_ma
ke.out
Thank you in advance for your help
You need to install Ruby DevKit if on windows, get it from: http://rubyinstaller.org/downloads/ (scroll down a little).
Same story here deleting ruby and installing:
Ruby 2.0.0-p247
DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
from http://rubyinstaller.org/downloads/ solved the problem.
Try to use railsinstaller from http://railsinstaller.org/
it will install follwing
Ruby 1.9.3-p392
Rails 4
Bundler
Git
Sqlite
TinyTDS
SQL Server Support
DevKit
The same can happen when you try to combine 32-bit Ruby and 64-bit DevKit.
The solution is to use same-bit versions.
For instance current versions:
rubyinstaller-2.0.0-p247-x64.exe
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
I just wanted to install rmagick under windows.
So I installed ImageMagick with C/C++ header, but that seems no more to be necessary.
Then I installed the Ruby Build Tools
ruby dk.rb init
ruby dk.rb install
Then I wanted to install the rmagick gem with gem install rmagick.
But I get this error:
H:\Downloads\ruby build tools>gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.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:/Ruby192/bin/ruby
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate
an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1
for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Before I installed the Build Tools, I just got the advice to install them.
Now they are installed and I get a different error message than before (see above).
It still wants me to install the Build Tools, so its installation might be broken?
I get the same error with linecache... also something with the mkmf file and build tools.
I guess this is a common error.
I had to install Ruby on Rails first, and then from the Command Prompt with Ruby and Rails, I ran:
gem install rmagick --platform=ruby -- --with-opt-dir=C:\ImageMagick
It all worked, and I saw this:
Fetching: rmagick-2.13.2.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.2
1 gem installed
Installing ri documentation for rmagick-2.13.2...
Installing RDoc documentation for rmagick-2.13.2...
Windows 7 64bit, but installed the 32-bit version of ImageMagick to C:\ImageMagick
I installed ImageMagick and RMagick on Windows Vista in a Rails environment this way:
First I downloaded ImageMagick-6.6.7-Q16 from http://www.imagemagick.org/download/binaries/ and installed it in "C:\ImageMagick-6.6.7-Q16" folder.
Then I downloaded RMagick from https://github.com/rmagick/rmagick/zipball/master and extracted it into "C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\bundler\gems\rmagick-rmagick\" folder (which is my ruby bundler gems folder).
Then I simply called
'gem install rmagick'
from my prompt and it all worked fine.
Now I can call from a Rails app Gemfile
gem "rmagick"
And then 'bundle install' works fine.
PS: please note that I first installed Rails with http://www.railsinstaller.org.
Include the head files & lib files to your System Environment first:
set CPATH=C:/Progra~2/ImageMagick-6.7.0-Q16/include
set LIBRARY_PATH=C:/Progra~2/ImageMagick-6.7.0-Q16/lib
Them, gem install ** will be done.
~.~
I got also the same error checking for stdint.h...
The problem was that I've installed ImageMagick on C:\Program Files (x86)\ImageMagick which contains spaces. So I deinstall ImageMagick and installed again to C:\Ruby19\ImageMagick.
Here is what I've done (Ruby 1.9.3, mingw32)
Download ImageMagick-6.7.7-9-Q8-windows-dll.exe (the newest version of ImageMagick seems to be incompatible with rmagick)
Install to C:\Ruby19\ImageMagick. The path must not contain spaces!
Set install configuration to
Add application direcotry to your system path
Install development headers and libraries for C and C++
gem install rmagick --platform=ruby -- --with-opt-dir=C:\Ruby19\ImageMagick
I installed RMagick using these instructions. Note that it calls for Ruby 1.9.1, but works (for me anyway) on 1.9.2 (i386-mingw32). I recommend uninstalling/reinstalling ImageMagick using the version specified in the instructions.
If possible try replacing RMagick with Mini_Magick, it aims to do the same thing but a different way. I had no luck with RMagick but Mini_Magick installed in the bundle