pg.so problem with Ruby in Windows - windows

I have installed the pg module with help of
gem install pg
Which returned
Successfully installed pg-0.8.0-x86-mswin32-60
When a .rb-file looks like this
require 'rubygems'
require 'pg'
I get an LoadError (exception 126) which tells me that it can't find the module C:/Ruby/lib/ruby/gems/1.8/gems/pg-0.8.0-x86-mswin32-60/lib/pg.so.
I heard something about that it is a Linux compilation. I'm really stuck so I really welcome suggestions.
I have also installed PostgreSQL, I use Windows XP.

Perhaps it's not pg that's missing but some other dependency? Perhaps devkit?: http://blog.smajn.net/2009/07/installing-ruby-191-rails-232-and.html

pg gem depends on PostgreSQL DLL being in the PATH.
In case the required DLL is not found, Ruby will throw a loading error about pg.so
Please check that PostgreSQL binaries and DLL are in the PATH:
SET PATH
Or copy the required DLL (pq.dll) has been copied to Ruby installation directory.
I recommend read this blog article about setting PostgreSQL with new RubyInstaller (One-Click Installer successor):
Install Ruby 1.9.1 and Rails 2.3.2 on Windows Vista
Hope that helps.

I just wrestled with this myself.
1) Make sure C:\Program Files\PostgreSQL\8.4\bin is in your path (as Luis suggested)
2) Make sure the libeay32.dll and ssleay32.dll from C:\Program Files\PostgreSQL\8.4\bin are loaded first. In my case I copied them over from C:\ruby\bin, which (in my case) is first in my path.
I was getting errors like
The ordinal 4046 could not be located in dynamic link library LIBEAY32.dll
and
The ordinal 284 could not be located in the dynamic link library SSLEAY32.DLL
until I did step 2)
Good luck...

Related

RGeo on Ruby under Windows: How to enable GEOS support?

I'm trying to do some spatial operations in Ruby with the RGeo gem. Unfortunately, a lot of operations require the GEOS library and I can't find any documentation showing how to integrate this in Windows (I am using Windows 7 64bit).
I tried downloading and installing the Windows binaries of GEOS from http://trac.osgeo.org/osgeo4w/ and reinstalling the RGeo gem via gem install rgeo -- --with-geos-dir="C:\OSGeo4W64\bin (<< in this directory there is a file geos_c.dll).
Still, using RGeo::Geos.supported? returns false.
Does anybody know how to solve this?
For anyone else looking to do this - here are some tips as to how I got it working.
install GEOS Windows binaries by following the link from http://trac.osgeo.org/geos/ (I have Ruby 32 bit version, so I went for the 32 bit version)
you should now be able to find a file geos_c.dll in C:\OSGeo4W\bin
set a Windows environment variable ENV['GEOS_LIBRARY_PATH'] to be C:\OSGeo4W\bin
check at this point to make sure that ENV variable is there - maybe restart your PC!
in your Gemfile, add gem 'ffi-geos' and gem 'rgeo' and bundle install
in your Ruby file, remember to require 'ffi-geos' and require 'rgeo' (in that order)
use factory = RGeo::Geos.factory(:native_interface => :ffi) - not RGeo::Cartesian.factory
check RGeo::Geos.supported? as Dirk said

Typhoeus Windows installation

Tried installing Typhoeus on a Windows 7 environment. Gem installs successfully but when trying to run a simple ruby script::
require 'typhoeus'
Typhoeus.get("www.google.com", verbose: true)
I get the following error::
D:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open l
(LoadError)url': The specified module could not be found.
.
Could not open library 'libcurl.dll': The specified module could not be found.
.
Could not open library 'libcurl.so.4': The specified module could not be found.
I tried adding curl.exe and libcurl.dll that I found in one of the packages on the curl website but that didn't help. Not sure what to do at this point. Thnks.
Seem to have figured it out. If anyone is having the same issue, make sure to download the following package from curl.haxx.se/download.html
Win32 2000/XP zip 7.34.0 libcurl SSL Günter Knauf 3.34 MB
Extract the bin directory to wherever and make sure to add it to your PATH. I also added .DLL to PATHEXT reset comp and it worked.
I just had the same problem on Windows 7 x64 and answered about it here. Typhoeus requires Ruby-FFI (see this answer) and libcurl.
The accepted answer is a little out of date now, but the same idea works:
Get a libcurl.dll from one of the packages here:
https://curl.haxx.se/gknw.net/7.40.0/dist-w64/ and put it on the PATH.
(I did not add .DLL to the PATHEXT)

installing Ruby rails, Could not locate gemfile

I'm trying to Learn ruby atm. am having alot of problems installing ruby on rails on my computer. I'm Using the one click installer and this how to install tutorial.http://www.hashemzahran.com/riding-the-rails-installing-ruby-on-rails/
My first problem i ran into was that it couldn't find the lib file. so i created and a new lib folder and believe i corrected that problem
now though when i try to run bundle install i get the error "Could not locate gemfile" i found I've been checking around through Google but have not been able to find an answer to the question. I'm running Windows 7 if that matters.
thanks for any help you can give me. I'm completely new to this.
install through this guide..
ruby on rails
try to install ruby-1.9.2-p180

Using curb gem and libcurl on Windows

I am trying to install the curb gem, which is libcurl bindings for Ruby, and of course I need to have "A working (lib)curl installation, with development stuff" installed on my computer. So, I went to the cURL Download Wizard and downloaded this package.
But adding the bin into my PATH does not produce improvement and I still get an error when I try to install the curb gem, such as:
extconf.rb:19: Can't find libcurl or curl/curl.h
(RuntimeError)
Even though, curl is already in the PATH.
EDIT: I also tried raking the gem, as per the instructions. It fails saying "make failed" and throwing a bunch of errors like this:
C:/Ruby/lib/ruby/gems/1.8/gems/curb-0.7.7.1/ext/curb_postfield.c:76:
undefined reference to
`_imp__curl_formadd'
Execute Below command for windows only and its works
gem install curb --platform=mswin32
I realise this is a very old question, but I had this exact problem today and found the instructions on someone else's site. These worked for me so I thought I would share them since people with this issue are most likely to come across StackOverflow first: http://jes.al/2012/10/installing-curb-gem-on-windows-7/
In a nutshell:
Get the 32-bit development version of curl (see my notes below)
Add the curl bin directory to your PATH
Run the following command (replacing the paths to curl as necessary)
gem install curb --platform=ruby -- -- --with-curl-lib="C:/curl-7.27.0-devel-mingw32/bin" --with-curl-include="C:/curl-7.27.0-devel-mingw32/include"
A couple of personal notes:
Even though I am on 64-bit Windows 7, I had to download the 32-bit libcurl version under "Win32 - Generic", identified as "Win32 2000/XP zip".
I got the error c:/Ruby193/lib/ruby/1.9.1/mkmf.rb:246:in 'initialize': Permission denied - mkmftmp1.log (Errno::EACCES) while installing the gem. This rather messed up page here suggested that it might be a problem with my anti-virus, and that just retrying a couple of times might work, and indeed, it did.

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