When I type ‘gem install RedCloth’ in the command line, I get this:
C:\Users\Kaye>gem install RedCloth
Building native extensions. This could take a while…
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for main() in -lc… *** 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
–with-redcloth_scan-dir
–without-redcloth_scan-dir
–with-redcloth_scan-include
–without-redcloth_scan-include=${redcloth_scan-dir}/include
–with-redcloth_scan-lib
–without-redcloth_scan-lib=${redcloth_scan-dir}/lib
–with-clib
–without-clib
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in try_do': The complier failed to genera te an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:intry_link0’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in try_link' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:intry_func’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:748:in block in have_library' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:inblock in
checking_for’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in block (2 levels) in postp one' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:inopen’
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:inopen’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in postpone' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:inchecking_for’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:743:in have_library' from extconf.rb:5:in’
Gem files will remain installed in
C:/Ruby192/lib/ruby/gems/1.9.1/gems/RedCloth-
4.2.8 for inspection.
Results logged to
C:/Ruby192/lib/ruby/gems/1.9.1/gems/RedCloth-4.2.8/ext/redclot
h_scan/gem_make.out
C:\Users\Kaye>
I have no idea why this happened and no idea how to install it properly.
I’m just following instructions from a book. If you have the time,
please elaborate on your answers.
When I type ‘gem install RedCloth’ in the command line, I get this:
C:\Users\Kaye>gem install RedCloth
Building native extensions. This could take a while…
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for main() in -lc… *** 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.
"Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. " […]
“You have to install development tools first.”
This might provide some information.
Are you using Ruby 1.9.2 provided from RubyInstaller?
If so, then you should have installed DevKit, available in the same page
and with installation instructions here:
If you followed all the instructions, there is a high chance the problem
you’re having is covered in RubyInstaller’s troubleshooting page:
Please check all the other elements from above wiki page for other
issues.
I downloaded DevKit-3.4.5-20100819-1535-sfx.exe and followed the
instructions on
Under Installation Instructions number 5, when I typed
‘gem install rdiscount --platform=ruby’ , I got the following:
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe 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
–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
–with-rdiscount-dir
–without-rdiscount-dir
–with-rdiscount-include
–without-rdiscount-include=${rdiscount-dir}/include
–with-rdiscount-lib
–without-rdiscount-lib=${rdiscount-dir}/lib
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:435:in try_link0’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in try_link' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in try_func’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in block in have_func' 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:796:in have_func' from extconf.rb:5:in ’
Gem files will remain installed in
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 for inspection.
Results logged to
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ext/gem_make.out
I tried the suggestions at
under ‘ERROR: Failed to build gem native extension’ , I tried the
scenarios A and B.
In scenario A, it’s ComSpec=C:\Windows\system32\cmd.exe , so nothing
wrong with it.
In scenario B,
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
CompletionChar REG_DWORD 0x9
DefaultColor REG_DWORD 0x0
EnableExtensions REG_DWORD 0x1
PathCompletionChar REG_DWORD 0x9
…there’s no AutoRun in it, so nothing wrong too.
Building native extensions. This could take a while…
–with-opt-dir
–with-rdiscount-dir
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in try_func' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:inpostpone’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in checking_for' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:inhave_func’
from extconf.rb:5:in `’
Gem files will remain installed in
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 for inspection.
Results logged to
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ext/gem_make.out
What is in the log files? Check the directory named at the bottom of
this output.
Gem files will remain installed in
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8 for inspection.
Results logged to
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ext/gem_make.out
What is in the log files? Check the directory named at the bottom of
this output.
Adam S.
Hi Adam.
I opened the gem_make.out with Notepad:
C:/Ruby192/bin/ruby.exe 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
–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
–with-rdiscount-dir
–without-rdiscount-dir
–with-rdiscount-include
–without-rdiscount-include=${rdiscount-dir}/include
–with-rdiscount-lib
–without-rdiscount-lib=${rdiscount-dir}/lib
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:435:intry_link0’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in try_link' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:intry_func’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in block in have_func' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:inblock 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:inopen’
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:inopen’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in postpone' from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:inchecking_for’
from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in have_func' from extconf.rb:5:in’
Is this what you’re asking? I have no idea what to do with it.
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.
This is the pertinent detail of the log.
Is this what you’re asking? I have no idea what to do with it.
Well, in general, reading logfiles is a good idea to start out.
The Cliff’s Notes: You need the DevKit from rubyinstaller.org, which
enables you to compile native extensions.
Ruby is installed in the default folder: C:\Ruby192
Devkit is installed in ‘C:\DevKit’ (I merely followed the example from
the website with Devkit instructions.)
Does the config.yml file
generated by the DevKit setup match your installed Ruby?
I’m not sure what you mean by that but I tried opening the config.yml
file found in ‘C:\DevKit’ with SciTE and this is what it says:
This configuration file contains the absolute path locations of all
installed Rubies to be enhanced to work with the DevKit. This config
file is generated by the ‘ruby dk.rb init’ step and may be modified
before running the ‘ruby dk.rb install’ step. To include any installed
Rubies that were not automagically discovered, simply add a line below
the triple hyphens with the absolute path to the Ruby root directory.
Example:
—
- C:/ruby19trunk
- C:/ruby192dev
C:/Ruby192
Do you have the operating_system.rb file as mentioned in step 4? Does it
look right?
I can’t find the operating_system.rb file.
From Step 4: “finally, ruby dk.rb install to DevKit enhance your
installed Rubies. This step installs (or updates) an operating_system.rb
file into the relevant directory needed to implement a RubyGems
pre_install hook…”
I don’t even know what the ‘relevant directory’ is.
If it’s the C:\DevKit directory, operating_system.rb is NOT there.
If you’re not sure, you could try posting that and your
devkit.rb file here so we can review them.
In C:\Ruby192\lib\ruby\site_ruby , there is a devkit.rb , opened it with
SciTE, contents are:
enable RubyInstaller DevKit usage as a vendorable helper library
unless ENV[‘PATH’].include?(‘C:\DevKit\mingw\bin’) then
puts ‘Temporarily enhancing PATH to include DevKit…’
ENV[‘PATH’] = ‘C:\DevKit\bin;C:\DevKit\mingw\bin;’ + ENV[‘PATH’]
end
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.
Is this what you’re asking? I have no idea what to do with it.
Ah, it’s the same as what was output to your console. I was hoping it
would have more information.
Where is Ruby installed on your system? Does the config.yml file
generated by the DevKit setup match your installed Ruby?
Do you have the operating_system.rb file as mentioned in step 4? Does it
look right? If you’re not sure, you could try posting that and your
devkit.rb file here so we can review them. I don’t know what it’s
supposed to look like, but I can at least see the source and make an
educated guess.
Show the results for Luis’ question by changing to your C:\DevKit
directory and running “ruby dk.rb install” Also show us your
operating_system.rb once you’ve found it.
The fix may be as simple as “ruby dk.rb install --force” but reply with
answers before running that command.
"For RubyInstaller’s previous to 1.9.2-p0 you may feel more comfortable
using the DevKit-3.4.5-CCYYMMDD-sfx.exe as the earlier RubyInstallers
were built using MSys/MinGW v3.4.5. "
My Ruby is 1.9.2-p0 and that is why I chose DevKit 3.4.5
While the gist is particular to my system and installing rdiscount, I
suspect that your operating_system.rb doesn’t look like what’s shown.
I found operating_system.rb at
C:\Ruby192\lib\ruby\1.9.1\rubygems\defaults , opened it with SciTE:
override ‘gem install’ to enable RubyInstaller DevKit usage
Gem.pre_install do |i|
unless ENV[‘PATH’].include?(‘C:\DevKit\mingw\bin’) then
puts ‘Temporarily enhancing PATH to include DevKit…’
ENV[‘PATH’] = ‘C:\DevKit\bin;C:\DevKit\mingw\bin;’ +
ENV[‘PATH’]
end
end
I guess you’re right, Jon? It doesn’t look like yours.
Would you mind explaining its significance?
Show the results for Luis’ question by changing to your C:\DevKit
directory and running “ruby dk.rb install”
The result is:
C:\DevKit>ruby dk.rb install
[INFO] RubyGems override already in place for C:/Ruby192, skipping.
[WARN] DevKit helper library already exists for C:/Ruby192, skipping.
I guess that’s because I’ve already installed dk.rb?
Or should I uninstall Ruby and DevKit and starch from scratch?
"For RubyInstaller’s previous to 1.9.2-p0 you may feel more comfortable
using the DevKit-3.4.5-CCYYMMDD-sfx.exe as the earlier RubyInstallers
were built using MSys/MinGW v3.4.5. "
‘previous to 1.9.2-p0 …’ means versions BEFORE 1.9.2-p0 ??
Sorry =)
Hey thanks Philip! I knew it.
So if the problem is I downloaded a wrong version of Devkit, how do I
uninstall the wrong Devkit? Do I just delete everything in C:\DevKit ?
There’s no ‘uninstall’.
So sorry guys for the inconvenience, if the problem is merely the wrong
version of DevKit. I’m not an expert. Be nice. =)
"For RubyInstallers previous to 1.9.2-p0 you may feel more comfortable
using the DevKit-3.4.5-CCYYMMDD-sfx.exe as the earlier RubyInstallers
were built using MSys/MinGW v3.4.5. "
My Ruby is 1.9.2-p0 and that is why I chose DevKit 3.4.5
Which means that you should use a DevKit later than 3.4.5 for Ruby
versions >= 1.9.0!
"For RubyInstaller’s previous to 1.9.2-p0 you may feel more comfortable
using the DevKit-3.4.5-CCYYMMDD-sfx.exe as the earlier RubyInstallers
were built using MSys/MinGW v3.4.5. "
My Ruby is 1.9.2-p0 and that is why I chose DevKit 3.4.5
Just in case this is helpful to anyone else, I came across this post and
had the exact same problem only I was already using version 4.5.2 of the
devkit so this post didn’t really help me much.
I felt like I had tried everything, and I was mainly executing out of
PowerShell, so as a hail mary I switched over to command and low and
behold right before execution ended in the error reported in this post I
got a Windows error popup saying:
as.exe - Entry Point Not Found
The procedure entry point libiconv_set_relocation_prefix could not be
located in the dynamic link library libiconv-2.dll
I started searching around for that error and found an obscure post on
the Harbor Google Group talking about problems with libiconv-2.dll
(https://groups.google.com/d/msg/harbour-devel/sM7uXpWaftk/Y7mc3OKoEmsJ).
In the very last post one of the forum helpers told the person to check
for other copies of the libiconv-2.dll file, so I decided to follow
that.
After searching my entire disk, I found that I had 4 libiconv-2.dll
files:
1 in C:\DevKit\mingw\bin
1 in C:\DevKit\mingw\libexec\gcc\mingw32\4.5.2
1 in C:\Windows\SysWOW64
1 in C:\Program Files (x86)\Git\bin
At that point I started with the Git DLL and worked my way back to the
Windows one and renamed them to .bak. Sure enough after renaming the
libiconv-2.dll in C:\Windows\SysWOW64 I was able to compile rdiscount
without a hitch.
I don’t really see this as much of a permanent solution as I am pretty
sure that, that dll is needed by Windows to run 32-bit programs on
64-bit platforms, but I was able to use renaming it as a workaround so
that I could install the few gems that I really cared about before
renaming it back the way it was so I didn’t end up with Windows problems
down the line.
Anyway, hopefully this helps someone else out there! It took a long time
to track down.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.