I have experienced this a few times trying to install different gems using 32 bit ruby, this time I upgraded to Ruby 3.1.2 in hopes it would be resolved
Specifically it appears that either gem maintainers, or the maintainer of MSYS/MINGW dont wrap the Program Files path in quotes, so the space in the folder name seems to be crashing the script.
Would be grateful for any solutions
PS C:\Users\alilland\Documents\dev\scheduler2.0> gem install bson -v 4.12.1
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing bson:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1/ext/bson
C:/Ruby31/bin/ruby.exe -I C:/Ruby31/lib/ruby/site_ruby/3.1.0 extconf.rb
creating Makefile
current directory: C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1/ext/bson
C:Program Files \(x86\)GnuWin32binmake.exe DESTDIR\= sitearchdir\=./.gem.20221013-364-mygij2 sitelibdir\=./.gem.20221013-364-mygij2 clean
current directory: C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1/ext/bson
C:Program Files \(x86\)GnuWin32binmake.exe DESTDIR\= sitearchdir\=./.gem.20221013-364-mygij2 sitelibdir\=./.gem.20221013-364-mygij2
make failedNo such file or directory - C:Program
Gem files will remain installed in C:/Ruby31/lib/ruby/gems/3.1.0/gems/bson-4.12.1 for inspection.
Results logged to C:/Ruby31/lib/ruby/gems/3.1.0/extensions/x86-mingw32/3.1.0/bson-4.12.1/gem_make.out
Edit:
after looking to implement the solution mentioned below (moving the GnuWin32binmake.exe file to a different path) I discovered that its actually an entire folder path thats crammed into a string, its supposed to be a filepath C:\Program Files (x86)\GnuWin32\bin\make.exe
Also mongodb the (the bson gem maintainer) provides no way for the public to report bugs, having disabled bug reporting on github, and their online issue tracker for Jira does not allow the general public access.
Related
I wanted to install the rspec-rails gem with ruby 1.9.3 on windows 7. I got some errors saying that some json libraries could not be installed. So, I used the instructions below to solve it.
Source = The 'json' native gem requires installed build tools
Download [Ruby 1.9.3][2] from [rubyinstaller.org][3]
Download DevKit file from [rubyinstaller.org][3]
For Ruby 1.9.3 use [DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe][4]
Extract DevKit to path C:\Ruby193\DevKit
Run cd C:\Ruby193\DevKit
Run ruby dk.rb init
Run ruby dk.rb review
Run ruby dk.rb install
To return to the problem at hand, you should be able to install JSON (or otherwise test that your DevKit successfully installed) by running the following commands which will perform an install of the JSON gem and then use it:
gem install json --platform=ruby
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"
When I execute the above first step, I get the error -
C:\Ruby193\DevKit>gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
'make' is not recognized as an internal or external command,
operable program or batch file.
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
I am trying to solve the above error now -
'make' is not recognized as an internal or external command, operable program or batch file.
using make is not recognized as an internal or external command - Qt SDK - Windows
If someone already knows how to fix this, then please help me. I have been struggling to install gems and I am failing for so many days. I am wondering if ruby is so difficult.
The DOSKEY approach failed !!!
I did this - Install Mingw and installed all its developer tools and base stuff. Then added C:\MinGW\bin to environment variables to find mingw32-make.exe. Then, I ran the DOSKEY make=mingw32-make followed by the ruby command. I got the same error. I am guessing that the ruby code is spawning off a hidden cmd window and thats why the command is not working. DOSKEY is valid only in the cmd window in which you run it.
Next step - Not so nice, but, I'll change mingw32-make.exe to make.exe and see.
Failed again with a new error -
Temporarily enhancing PATH to include DevKit... Building native
extensions. This could take a while... ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb creating Makefile
make generating generator-i386-mingw32.def compiling generator.c In
file included from generator.c:1:0: ../fbuffer/fbuffer.h:5:18: fatal
error: ruby.h: No such file or directory #include "ruby.h"
^ compilation terminated. Makefile:204: recipe for target 'generator.o' failed make: *** [generator.o] Error 1
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
What do I do now ?
Most of the Ruby gems are developed for Unix and require some extra tools to make it work on Windows.
In order to install those gem in Windows, you need Ruby DEVELOPMENT KIT from the download link (choose the correct installer based on your Ruby version).
Extract the installation to some permanent location. In my system, it is C:\RubyDevKit.
Open command prompt and cd to the extracted location and execute the following commands
cd C:\RubyDevKit
ruby dk.rb init
ruby dk.rb install
devkitvars.bat
The last command is what I missed initially and took sometime to figure out. Now try installing your gem; it worked for me.
Additional Information
The Ruby Development Kit has a component called MinGW which is used to run Unix command on Windows.
The below error, in my case, was Ruby Development Kit not added to the system path variable
make
'make' is not recognized as an internal or external command,
operable program or batch file.
The command devkitvars.bat adds the Development Kit to the system path.
Try installing gnuwin-32 make and then change environment variable PATH to point to C:\Program Files (x86)\GnuWin32\bin
Ruby installation wizard asks you "Add Ruby executables to your PATH", for me, easy solution is to uninstall ruby and install again, this time checking the check box "Add Ruby executables to your PATH"
With the latest version of Ruby 2.4.2, the dev kit is included in the installation so you don't need to follow the separate install instructions. Just uninstall existing ruby and reinstall the new one here https://rubyinstaller.org/downloads/.
Once finished, it'll open up a command prompt on which you need to select option 3 to include the dev kit. However, at the time of writing it's so buggy and you may or may not have issues installing.
I have tried to setup ruby on rails on a windows system, although there are one click installers that install ruby itself and rails, many of the gems rely on a posix based operating system to be compiled, thus making it near impossible to do actual work on windows.
My advise would be to get yourself a linux system, perhaps unbuntu on your system and dual boot, or get a virtual pc software, like this one, or any of the other options, and try installing ruby from there.
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 into C:/Ruby193
Ruby 2.0.0p353 with Ruby Installer 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 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 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, 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, 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:
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.
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.
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: http://gist.github.com/dannysmith/8055495
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?
Try running command prompt in admin mode. After like 7-10 hours I figured this out...
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 https://github.com/oneclick/rubyinstaller/issues/184
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
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.
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.
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:
Rails on windows - install issue
How I fixed it:
Downloaded the latest ruby installer from https://rubyinstaller.org/downloads/
Ran the installer, following the prompts to install dependencies.
Restarted my computer.
Added the ruby/bin directory to my PATH.
I installed Ruby on Windows via RubyInstaller, with the associated DevKit.
I'm trying to run various scripts (mainly Jekyll), and I'm getting all sorts of errors about paths. For instance:
...cannot load such file -- redcarpet.so (LoadError)
Or:
...cannot load such file -- 2.0/redcloth_scan (LoadError)
Specifically, in both those cases, I'm trying to run "redcloth.bat" and "redcarpet.bat" in the bin directory of the Ruby directory.
I feel like I'm missing something basic with paths. Note that this has never worked -- I installed the RubyInstaller, then the DevKit, then the Jekyll gem...and this is what happened.
Is there something basic about this installation that I failed to set?
We ran into the RedCloth side of this error today.
We started with this error
How to install RedCloth on Windows?
What we found was we had installed the mswin32 version of RedCloth, we first got the no such file to load.
We then went to our
C:\ruby200/lib/ruby/gems/1.9.1/gems/RedCloth-mswin32
Directory , added the 2.0 file and copied the redcloth_scan.so file into the 2.0 directory.
We started getting another error that was similar.
We decided we would just uninstall the precompiled version of the gem, and start with the normal RedCloth-2.4.9.gem to be compiled locally with devkit.
Once this was installed, we again went to the lib dir for the gem.
CD C:/ruby200/lib/ruby/gems/1.9.1/gems/RedCloth-2.4.9/lib
We created a 2.0 directory
We then copied the file redcloth_scan.so file into the 2.0 directory and we no longer had the error. The server came up fine and we
I'm trying to get Jekyll running on Windows 8 x64, using this manual:
Running Jekyll on Windows
I'm using the following two downloads from rubyinstaller.org:
Ruby 2.0.0-p0 (x64)
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
So I set up both Ruby and the DevKit according to the manual (expect it's newer versions). I tried running a little Hello World .rb script and it's working fine, path variables are set.
I then try to run gem install jekyll and I get the following output:
gem install jekyll - output on pastebin.com
The problem seems to be with the gem called fast-stemmer-1.0.2.gem, or so it seems.
Unfortunately I have practically zero experience with Ruby or Jekyll and have no idea what is going on here. Could someone please take a look at the output and send me into the right direction?
Thanks
Have you tried uninstall Ruby/DevKit and try the whole thing again, but this time, install Ruby to the default directory like C:\Ruby200-x64 instead of C:/Program Files/Ruby/Ruby200-x64
As I suspect the space in your ruby directory could be the issue. (Line 296 of your error txt)
/usr/bin/install: target
`Files/Ruby/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fast-stemmer-1.0.2/lib'
is not a directory make: *** [install-so] Error 1
Also quote from Issues installing Ruby and Rails and DevKit on windows 7 x64 - fix needed
Seems you installed Ruby (along the DevKit?) inside a directory with
spaces.
As indicated during Ruby own installer, path with spaces are not
recommended (that is why default is C:\Ruby193
GCC, the compiler that is part of DevKit, has problems with path with
spaces, so installation of DevKit is also recommended to be placed in
a path without spaces (e.g. C:\DevKit)
I am trying to set up Ruby on Rails on windows. I am using the Flash Rails distribution that looks pretty good, but there is an issue with sqlite3. I found the threads telling me to install version 1.2.3, which installed fine. I'm using ruby 1.9.0, and every time I try and run a script (e.g. rake db:create) that uses the database I get an error message "no driver for sqlite3 found".
This apparently is a missing sqlite3.dll, but I have the dll in my %PATH%, and I have also tried copying it into the directory where I am running the script from, the directory where the sqlite3 ruby code lives.
Does anyone have any ideas? If possible I want all teh ruby stuff to be self contained so I can use it from a pen drive.
EDIT: To clarify, I already used gem install to install the ruby-sqlite3 gem - it is just non functional as it cannot find the sqlite3.dll (even though it is actually present in a directory on my %PATH%)
EDIT PART 2: After doing some more digging, the problem appears that ruby will not load the sqlite3_api.dll. I have copied it all over my filesystem, I just get a failure to read file. Other dll libraries in the same directory (e.g. zlib.dll) work fine!
I tried installing the dlls into system32, and that did not work either.
The problem put simply is that sqlite3-ruby 1.2.3 is not compatible with ruby 1.9. This is caused because ruby 1.9 does not use .dll files for c libraries it uses .so files instead. Additionally, since sqlite3_api.dll is written against msvcrt-ruby18.dll. This means that it specifically only will support ruby 1.8.*.
The good news is that there is a fat binary version that will support both ruby 1.8 and ruby 1.9. Uninstalling all former versions of sqlite3-ruby and then installing this one. (You may have to manually delete some versions the gem after uninstalling.) in order to install it use
install sqlite3-ruby --source http://gems.rubyinstaller.org
for more information see this website
Try installing the sqlite3-ruby gem:
gem install sqlite3-ruby
Something similar happened to me recently so I thought I'd update my answer.
For reference there's a sqlite3_api.dll file located in the gem's lib directory. Also the sqlite3.dll file needs to be reachable on the path. They are different files, the first is required by the gem to interface Ruby to C code, while the second contains the actual Sqlite implementation.
It's best to get the second file from the sqlite website and extract it to the Ruby\bin directory (as you shouldn't manually put DLL's into the windows or windows\system directories any more).
So for reference "sqlite3_api.dll" needs to be in:
Ruby\lib\ruby\gems\1.8\gems\sqlite3-ruby-1.2.3-x86-mswin32\lib
and "sqlite3.dll" needs to be on the path, possibly in:
Ruby\bin
As for the "driver not found" problem I would suggest trying the easy things first and making sure gems is installed correctly, up to date, and that the RUBYLIB and PATH environment variables are set appropriately. (System restart may be required to propagate the changes fully.)
Re this link
Download sqlitedll-3_6_10.zip and extract into ruby/bin!
Try going to sqlite.org download page and get the zipped up dll. Then put that in your c:\windows\system32 folder, that should allow Ruby to find it.
Restart your machine after running install sqlite3-ruby
To clarify, which gem are you using? sqlite-ruby or sqlite3-ruby?
They're part of the same project, but different releases. The key is that sqlite3 appears to have driver code included.
I assume you're attempting to use the first, since it's giving me the same error. If so, try switching.
Also.. How literal do you mean by this?
but I have the dll in my %PATH%
PATH=...;C:\sqlite\sqlite3.dll
PATH=...;C:\sqlite
The first will attempt to find C:\sqlite\sqlite3.dll\sqlite3.dll, AFAIK.
I use Ruby 1.8.7 (works with 1.9.1 too)
OS is WindowsXP SP3
Go to
http://www.sqlite.org/download.html
and Download file
sqlitedll-3_7_0_1.zip (265.19 KiB)
and unzip then we will get
sqlite3.dll
Copy sqlite3.dll to your bin folder
as C:\Ruby191\bin or C:\Ruby187\bin
then it works