I get a LoadError when trying to about anything with a new Ruby install on Windows - ruby

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

Related

OSX with RVM "cannot load such file -- bridgesupportparser (LoadError)"

I hit this problem running rake on a RubyMotion project, but it feels like it's a more general RVM-on-Mac issue.
I'm running rvm 2.3.1 on OSX 10.11.6
If I fire up irb and try require 'bridgesupportparser' I get the error
cannot load such file -- bridgesupportparser (LoadError)
I can find the .rb file at
/System/Library/BridgeSupport/ruby-2.0/bridgesupportparser.rb
And if I do
require '/System/Library/BridgeSupport/ruby-2.0/bridgesupportparser'',
I get a new error, which is
'cannot load such file -- bridgesupportparser.so'
It looks like I need bridgesupportparser.so and bridgesupportparser.rb to be somewhere ruby can find them.
I have several bridgesupportparser.rb files on my machine, but no bridgesupportparser.so. There are bridgesupportparser.bundle files, though - looks like they may be the Mac version of the .so files.
As I first ran into it with RubyMotion, I did the following:
New install of Xcode (8.0)
Deleted and reinstalled RubyMotion (4.13)
Tried this (suggested here):
mv /Library/RubyMotion/lib/BridgeSupport mv
/Library/RubyMotion/lib/BridgeSupport.bak
rake newclear
But none of that has fixed the issue. Any ideas appreciated!

Cannot install gem - make is not recognized as an internal or external command operable program or batch file

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.

Installing Shoes on Ubuntu 12.04: cannot find rubygems.rb

I'm trying to install Shoes on Ubuntu 12.04 64-bit and currently have Ruby 1.9.3 and 2.0.0 installed, with 1.9.3 as the default. I tried several different methods, running several different scripts, but nothing seems to be successful. I haven't gotten any error messages; The scripts just install a lot of libraries and then seem to build Shoes, and, though I now have a shoes directory full of files, when I try to execute /dist/shoes I get this error:
me#me-Studio-1735:~/shoes$ ./dist/shoes
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
uninitialized constant Encoding::UTF_7
These are the the steps I've taken, in order:
I downloaded the Shoes3 .run file from the official website, but when I tried to execute it, I get this output:
Verifying archive integrity... All good.
Uncompressing Shoes..................................................................................................................................................................................................................................................................................................................
./shoes-3.1.0.run: 1: eval: ./shoes: not found
I then attempted to follow the instructions for installing on Ubuntu; I ran the script they linked to, which took about 20 minutes, but afterwards I couldn't find the red-shoes directory: It didn't exist. All I got to show for it was a /tmp/shoes_build/ directory with a "chruby opt ruby-1.9.3-p392 ruby-build" directory listing.
Then I tried running the script from that same website listed directly on the site, not linked to. No Shoes. Lots of things were installed, but when I tried to execute /dist/shoes, I got the same error.
Finally, I tried executing the commands listed on the Spiral of Hope site listed under 'SUCCESS: Ubuntu?'. Again, it runs and installs lots of libraries, but Shoes isn't functional. It is neither a recognized command when typing shoes, nor can I execute anything successfully.
I don't know what else to do. I'm no Linux buff, I just have a knowledge of basic Bash commands, and I recently installed Ubuntu, so I haven't done any weird custom installs or anything. Can anyone tell me what I'm doing wrong, and how to do it right?

Trying to install Jekyll on Windows 8 (x64): Error installing fast-stemmer-1.0.2.gem

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)

Ruby cannot find sqlite3 driver on windows

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

Resources