Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 383 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'Failed to build gem native extension' on Windows 7 (The system cannot find the path specified)

#1
## The problem in short

I'm on Windows and am getting the following error when running `gem install json —platform=ruby`:

The system cannot find the path specified.
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

## Background and some Investigations

So first off, I'm not a Windows person so this is a brave new world for me. Having inherited a laptop from work that had a mad collection of libraries spread all over it I've managed to remove all previous installations of ruby and the Devkit and then installed the following:

- Ruby 1.9.3p484 with [Ruby Installer](

[To see links please register here]

) into `C:/Ruby193`
- Ruby 2.0.0p353 with [Ruby Installer](

[To see links please register here]

) into `C:/Ruby200`
- Devkit `DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe` (for ruby 1x) extracted into `C:/Ruby193-devkit`
- Devkit `DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe` (32-bit for ruby 2x) extracted into `C:/Ruby200-devkit-x32`.

I then installed [Pik 0.2.8](

[To see links please register here]

) as a gem and ran `pik_install` into a new directory `C:/bin` as per the installation instructions.

My PATH looks like this:

PATH=C:\bin;C:\Ruby193\bin;C:\windows;C:\windows\system32;C:\windows\system32\Wbem;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_33\bin;C:\Program Files (x86)\Common Files\Apple\Mobile Device Support\;C:\Program Files (x86)\Common Files\Apple\Apple Application Support;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;C:/inpath;C:\Program Files (x86)\WinMerge;C:\ChromeDriver;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64

The important things being that `C:/bin` and `C:/Ruby193/bin` are in the path. This means that ruby 1.9.3 is loaded by default when I fire up a shell and I can successfully switch to 2.0.0 with `pik use 2.0.0p353`. In other words, pik works fine.

Devkit [is intended](

[To see links please register here]

) to allow the compiling of native C/C++ binaries from gems on Windows, so as to aviod using precompiled windows binaries.

Because I've got two versions of ruby installed, and each requires a different devkit (one for 2x and one for 1x), I had to do the setup for devkit twice:

cd C:/Ruby193-devkit
ruby dk.rb init
# Edit config.yml to remove all but Ruby193
ruby dk.rb install

cd C:/Ruby200-devkit
ruby dk.rb init
# Edit config.yml to remove all but C:/Ruby200
ruby dk.rb install

At this point I should have been able to run `gem install json —platform=ruby` successfully, but got the error above. After a little digging [I discovered this](

[To see links please register here]

), which advises checking that COMSPEC is set corectly and removing any AutoRun keys from `HKEY_CURRENT_USER\Software\Microsoft\Command Processor` – I had one from ANSIcon and duly deleted it.

Unfortunatly I was still unable to install the json gem.

It then struck me that perhaps the wrong version of GCC was being used, or not being found. The two versions of Devkit come with different versions of gcc:

> C:\Ruby193-devkit\mingw\bin\gcc —version
gcc (tdm-1) 4.5.2

> C:\Ruby200-devkit-x32\mingw\bin\gcc —version
gcc (rubenv-4.7.2-release) 4.7.2

I then wondered if pik wasn't loading the version of devtools (and therefore gcc) for the specific version of ruby that i'd picked, and was always using 1.9.3. Thanks to [this article](

[To see links please register here]

), it seems that's not the case:

> pik use 193
> where ruby
C:\Ruby193\bin\ruby.exe

> cat C:\Ruby193\lib\ruby\site_ruby\devkit.rb
# enable RubyInstaller DevKit usage as a vendorable helper library
unless ENV['PATH'].include?('C:\\Ruby193-devkit\\mingw\\bin') then
puts 'Temporarily enhancing PATH to include DevKit...'
ENV['PATH'] = 'C:\\Ruby193-devkit\\bin;C:\\Ruby193-devkit\\mingw\\bin;' + ENV['PATH']
end
ENV['RI_DEVKIT'] = 'C:\\Ruby193-devkit'
ENV['CC'] = 'gcc'
ENV['CXX'] = 'g++'
ENV['CPP'] = 'cpp'


> pik use 200
> where ruby
C:\Ruby200\bin\ruby.exe

> cat C:\Ruby200\lib\ruby\site_ruby\devkit.rb
# enable RubyInstaller DevKit usage as a vendorable helper library
unless ENV['PATH'].include?('C:\\Ruby200-devkit-x32\\mingw\\bin') then
phrase = 'Temporarily enhancing PATH to include DevKit...'
if defined?(Gem)
Gem.ui.say(phrase) if Gem.configuration.verbose
else
puts phrase
end
puts "Prepending ENV['PATH'] to include DevKit..." if $DEBUG
ENV['PATH'] = 'C:\\Ruby200-devkit-x32\\bin;C:\\Ruby200-devkit-x32\\mingw\\bin;' + ENV['PATH']
end
ENV['RI_DEVKIT'] = 'C:\\Ruby200-devkit-x32'
ENV['CC'] = 'gcc'
ENV['CXX'] = 'g++'
ENV['CPP'] = 'cpp'
(I don't actually have cat available on windows but it makes for a clearer explanation)

As you can see, it looks like the correct version of devkit is being added to the path by devkit.rb, which is obviously being loaded because my error contains 'Temporarily enhancing PATH to include DevKit…'.

## Back to the original error

It was:

The system cannot find the path specified.
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

Unfortunatly the results log doesn't exactly offer much in the way of help. This is what gem_make.out looks like:

C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

I thought that `extconf.rb` might offer some help, but I can't make head nor tail of it:

require 'mkmf'

unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
$CFLAGS << ' -O3'
end
if CONFIG['CC'] =~ /gcc/
$CFLAGS << ' -Wall'
unless $DEBUG && !$CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
$CFLAGS << ' -O0 -ggdb'
end
end

$defs << "-DJSON_GENERATOR"
create_makefile 'json/ext/generator'

The Makefile in `C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator` [looks like this](). It seems odd to me that this Makefile is even being created.

If anybody with a bit more Windows/Ruby experience can shed any light on this it would be amazing!

PS. I'm on Windows 7 Professional SP1

## Update after some more digging

So I wanted to check that devkit was defiantly enhancing the path with the correct devkit directories. Thanks to a suggestion from another SO question, I moved the devkit installations inside the Ruby directories:

The tdm devkit now lives in `C:\Ruby193\devkit` while the mingw64 lives in `C:\Ruby200\devkit`. Having run `ruby dk.rb install -f` for each devkit, I opened up both devkit.rb files to check that the path's had been updated correctly. They had, and I updated the puts so it should print "Temporarily enhancing PATH do include DevKit for 1.9" or "Temporarily enhancing PATH do include DevKit for 2". By way of confirmation that the correct devkit is being loaded:

C:\>pik 193

C:\>ruby -rdevkit -ve "puts ENV['PATH']"
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
Temporarily enhancing PATH to include DevKit for 1.9...
C:\Ruby193\devkit\bin;C:\Ruby193\devkit\mingw\bin;C:\bin;C:\Ruby193\bin;C:\windows;C:\windows\system32;C:\windows\system32\Wbem;c:\Program Files (x86)
\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Pro
gram Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_33\bin;C:\Program Files (x86)\Common Files\Apple\Mobile Device Su
pport\;C:\Program Files (x86)\Common Files\Apple\Apple Application Support;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin
;C:/inpath;C:\Program Files (x86)\WinMerge;C:\ChromeDriver;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\sy
swow64

C:\>pik 200

C:\>ruby -rdevkit -ve "puts ENV['PATH']"
ruby 2.0.0p353 (2013-11-22) [i386-mingw32]
Temporarily enhancing PATH to include DevKit for 2...
C:\Ruby200\devkit\bin;C:\Ruby200\devkit\mingw\bin;C:\bin;C:\Ruby200\bin;C:\windows;C:\windows\system32;C:\windows\system32\Wbem;c:\Program Files (x86)
\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Pro
gram Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_33\bin;C:\Program Files (x86)\Common Files\Apple\Mobile Device Su
pport\;C:\Program Files (x86)\Common Files\Apple\Apple Application Support;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin
;C:/inpath;C:\Program Files (x86)\WinMerge;C:\ChromeDriver;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\sy
swow64

So that all looks like it works correctly. but:

C:\>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit for 2...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

C:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

C:\>pik 193

C:\>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

This clearly tells us two things:

1. Some other devkit.rb file is being loaded when I'm using ruby 1.9, as the 'for 1.9' message isn't being printed.
2. This is unlikely to be the actual problem, as the error is identical in either case.

I'm going to see if I can build manually using the generated Makefiles.
Reply

#2
How I fixed it:

1. Downloaded the latest ruby installer from

[To see links please register here]

2. Ran the installer, following the prompts to install dependencies.
3. Restarted my computer.
4. Added the ruby/bin directory to my PATH.
Reply

#3
Make sure that the ruby version you installed (32 or 64 bit) matches the DevKit version. They both have to be 32 or 64, which was the issue I was having. May not be the exact issue here, but thought I'd throw that out there. Here's a post worth checking out:

[To see links please register here]

Reply

#4
I had the same problem. I used powershell to check my path

> ps> $s = $env:path
>
> ps> $s.split("{;}")

sure enough my the ruby mingw was not in the path. I had the ruby\bin in the path but the mingw\bin was under a different folder. I went into my environment path and added it and my install worked.
Reply

#5
Install the 32 bit version on Windows...

ver
windows 6.1.76011

64 bit gave error message about makefile and headers. Tried all other suggestions including those on rubyinstaller about COMSPEC and registry, adding gcc to path, and others. Some gems would install but git_fame and json would not as needed to compile.

Edit: It looks like git_fame uses mimer_plus. mimer_plus assumes gnu tools (unix tools). Looks like you need to install mingw first. That was not clearly indicated on the rubyinstaller page.
Reply

#6
I have gem json installed with versions 1.8.1 but I was not able to solve this issue for json 1.6.1 using

gem install json --platform=ruby --verbose

So, I tried from here

[To see links please register here]


gem update --system 2.0.3

And after that

gem install json -v 1.6.1 --platform=ruby --verbose

It solve issue specific to json 1.6.1 for Win 7(64 bit) machine
Reply

#7
Try running command prompt in admin mode. After like 7-10 hours I figured this out...
Reply

#8
So this isn't the best answer in the world, but I seem to have stumbled on a solution. If I set the verbose flag, everything works fine:

gem install json --platform=ruby --verbose

There's a log here:

That makes no sense - it'd be great if someone could explain why this seems to have fixed the error. Perhaps this is a bug in devkit?
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through