1

I'm attempting to install the dandelion gem on on my Windows machine, but it keeps failing:

C:\Users\William>gem install dandelion --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing dandelion:
ERROR: Failed to build gem native extension.

C:/Ruby22/bin/ruby.exe -r ./siteconf20150623-7568-1ikffjg.rb extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... yes
checking for pkg-config... yes
-- cmake .. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_
FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "Unix Makefiles"
-- C:\DevKit\bin/make.exe
checking for main() in -lgit2... *** 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:/Ruby22/bin/$(RUBY_BASE_NAME)
--use-system-libraries
--with-git2-dir
--without-git2-dir
--with-git2-include
--without-git2-include=${git2-dir}/include
--with-git2-lib
--without-git2-lib=${git2-dir}/lib
--with-git2lib
--without-git2lib
C:/Ruby22/lib/ruby/2.2.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:/Ruby22/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:966:in `block in have_library'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from C:/Ruby22/lib/ruby/2.2.0/mkmf.rb:961:in `have_library'
from extconf.rb:89:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby22/lib/ruby/gems/2.2.0/gems/rugged-0.2
2.1b1 for inspection.
Results logged to C:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/rug
ged-0.22.1b1/gem_make.out

The error that states "you have to install development tools first" is a head-scratcher. I have already installed DevKit.

Any ideas how to solve this error?

Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63
Steed-Asprey
  • 2,001
  • 7
  • 24
  • 30
  • 2
    It also says `Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.`. Read the log files (or at least post them, so we can help you) for more information. But it looks like you're missing libgit2. The `You have to install development tools first.` is a bit confusing but unrelated to the RubyInstaller DevKit. – cremno Jun 23 '15 at 15:02
  • Thanks for responding. Here's the logs: http://pastebin.com/17m528Yn – Steed-Asprey Jun 23 '15 at 16:32
  • I should also note that the OpenSSL error is weird. I have that set on the PATH. Not sure what is going on there. – Steed-Asprey Jun 23 '15 at 16:41
  • @WilliamC please avoid excluding crucial elements (like logs) onto external services. – Mike Szyndel Jun 25 '15 at 09:17
  • @Michal Szyndel But I did include my logs... – Steed-Asprey Jun 25 '15 at 12:14
  • @WilliamC ok, so someone must have edited it and moved them to pastebin... :( – Mike Szyndel Jun 25 '15 at 17:49

1 Answers1

0

This is a fun one. I'm going to take a wild guess and say that you have a version of libgit2 located in C:/Program Files (x86)/libgit2/lib and that folder is somehow in your Path or possible some other environment variable.

The fix is to take that folder out of what environment variable that it could be in. That should let rugged build correctly.

The Problem

When gcc is trying to test for the libgit2 library it sees it could possibly be in C:/Program Files (x86)/libgit2/lib and uses -LC:/Program Files (x86)/libgit2/lib.

The problem is that it isn't properly escaped, which leads to

gcc: error: Files: No such file or directory
gcc: error: (x86)/libgit2/lib: No such file or directory

This is actually the same reason why Ruby can't be installed in folders with spaces.

As a side note: I'd like to point out that in addition to the regular DevKit you also have cmake and pkg-config somewhere installed and in your Path

Community
  • 1
  • 1
Azolo
  • 4,353
  • 1
  • 23
  • 31
  • thanks for the response. You are correct, I do have a copy of libgit2 in my Program Files (x86) directory and it is on my PATH. I'll remove that. – Steed-Asprey Jun 24 '15 at 16:16
  • Also, question about your last comment. Originally, I was getting errors when I had just DevKit installed, so I added cmake and pkg-config. That cleared the error. Should I remove those from my PATH? – Steed-Asprey Jun 24 '15 at 16:17
  • No, those are necessary, I just added that for other people that might stumble across this. – Azolo Jun 24 '15 at 16:23
  • I removed libgit2 from my path and it still errored out. Here was the error message: http://pastebin.com/KiCwAjNa Here is the log: http://pastebin.com/dHuLZGDX – Steed-Asprey Jun 24 '15 at 17:02
  • Still looking for it there, look at line #385 – Azolo Jun 24 '15 at 17:05
  • I see. What's weird is my PATH is clear and libgit2 is not in my Program Files (x86) directory any longer. Where else could this be set that I could look for? – Steed-Asprey Jun 24 '15 at 17:53
  • Honestly, I don't know. Maybe an `LDFLAGS` environment variable, it might be cached in the `makefile` already, or some other completely different thing. Look through your environment variables closely and try deleting the local files before you try again. – Azolo Jun 24 '15 at 21:08