Reputation: 31
I've been trying to do some simple "rails server" on my "Ruby on Rails" application, however I'm working with a friend of mine who is using linux, I'm sitting on windows xp (32 bit) everything is going smooth and all, he implement the gem called "curl" and "typhoeus", so in order for me to view it on my localhost:3000 I must install the gems aswell.
So this is what I wrote:
D:\>gem install typhoeus
Building native extensions. This could take a while...
ERROR: Error installing typhoeus:
ERROR: Failed to build gem native extension.
C:/Ruby187/bin/ruby.exe extconf.rb
checking for curl/curl.h in C:/Ruby187/lib/ruby/gems/1.8/gems/typhoeus-0.2.4/cro
ss/curl-7.19.4.win32/include... no
need libcurl
*** 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:/Ruby187/bin/ruby
Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/typhoeus-0.
2.4 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/typhoeus-0.2.4/ext/typhoeus/
gem_make.out
Yeah it does not look so pretty does it, but apparantly it asks for something called "libcurl", so I downloaded the curl version from internet for windows xp 32bit, I put the exefile & all the dll files in the windows folder. And I attempted to simply write "curl" to see if it worked. This is what I got:
D:\>curl
curl: try 'curl --help' or 'curl --manual' for more information
And I wrote gem install typhoeus again and I got the same error as above, what am I missing? Does libcurl not come with curl? I am in dire need of help because my friend can't help me because he's a linux-guy. So please help me - tell me what one must do to install typhoeus! (I also tried to write gem install typhoeus-0.2.4 but that threw out some other error:
ERROR: Could not find a valid gem 'typhoeus-0.2.4' (>= 0) in any repository
)
And I wrote that while being in the folder of the ruby on rails application. So I am lost and in great need of help!
Thanks in advance,
Harry
Upvotes: 3
Views: 3080
Reputation: 42207
This is no longer an issue in Ruby193 on windows vista/7. Just install typhoeus
gem install typhoeus
This gives no errors on my vista pc.
Make sure you can run curl.exe from anywhere by putting it in a path without spaces and with the location in your user or system path.
Include typhoeus in your script and you are done.
Upvotes: 0
Reputation: 582
I had a similar problem on Windows 7, and the issue was some of the logic in the extconf.rb file for windows machines. The following lines are what cause the need libcurl
error message:
if Config::CONFIG['target_os'] == 'mingw32'
header = File.join(ROOT, 'cross', 'curl-7.19.4.win32', 'include')
unless find_header('curl/curl.h', header)
abort "need libcurl"
end
The File.join
call causes the makefile to look for a directory (cross/curl-7.19.4.win32/include) that is not included with typhoeus, and therefore the makefile won't work.
I looked at a lot of the solutions on the web for most of a day (this link helped the most), and in the end found a workaround by simply changing the File.join()
to use the explicit file path for my curl gem. I edited the extconf.rb file twice, once here:
if Config::CONFIG['target_os'] == 'mingw32'
header = File.join('C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\gems\curl-7.19.4-devel-mingw32', 'include')
unless find_header('curl/curl.h', header)
abort "need libcurl"
end
And once here:
if Config::CONFIG['target_os'] == 'mingw32'
find_library('curl', 'curl_easy_init',
File.join('C:\RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\gems\curl-7.19.4-devel-mingw32', 'bin'))
I believe you may need the DevKit installed, but I'm not sure.
Hope this helps!
Upvotes: 2
Reputation: 10161
The downloads given by RocketR are not compatible with the latest version of Typhoeus (0.2.4). This comment on GitHub provided the solution for me (https://github.com/dbalatero/typhoeus/issues/11#issuecomment-309957)
less involved workaround for typhoeus
0.1.29 on ruby 1.9.1 -- just give it what it wants.
----------- checking for curl/curl.h in C:/path/to/ruby/gems/1.9.1/gems/typhoeus-0.1.29/cross/curl-7.19.4.win32/include... no need libcurl
-----------
download: http://www.gknw.de/mirror/curl/win32/old_releases/curl-7.19.4-devel-mingw32.zip
mkdir C:/path/to/ruby/gems/1.9.1/gems/typhoeus-0.1.29/cross, extract, rename to curl-7.19.4.win32
gem install typhoeus, as you would normally.
Upvotes: 1
Reputation: 3776
Please try this fork: https://github.com/NoKarma/typhoeus/downloads I found different solutions in the net, but only this worked. Maybe some day they will finally fix it to compile under Windows.
Upvotes: 1