Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
694 views
in Technique[技术] by (71.8m points)

curl - Install Ruby Curb gem in windows XP

I'm trying to do file uploads with ruby 1.8 and it seems like there are no good out-of-the-box solutions. They all seem to need some 3rd party patch or fork of a project to work. I would use mechanize but I actually need to interface with an xml api and mechanize seems to be made specifically for dealing directly with webpages. I've tried RestClient but it doesn't have that functionality for multipart forms out of the box, you have to use a fork of the project to get it to work. Similar situations seem to exist for Net:HTTP I'm thinking curb would be the way to go since I may want to use multicurl anyways for some other things I plan to do. However, on my windows machine I can't seem to install the curb gem. gem install curb gives an error saying I need to specify where the curl library lives.. I've tried passing options to extconf but no luck so far. Here is the output of gem install curb without any options

C:
ubylib
ubygems1.8gemscurb-0.5.4.0>gem install curb
Building native extensions.  This could take a while...
ERROR:  Error installing curb:
        ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb
checking for curl-config... no
checking for main() in curl.lib... no
*** 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
        --srcdir=.
        --curdir
        --ruby=C:/ruby/bin/ruby
        --with-curl-dir
        --without-curl-dir
        --with-curl-include
        --without-curl-include=${curl-dir}/include
        --with-curl-lib
        --without-curl-lib=${curl-dir}/lib
        --with-curllib
        --without-curllib
extconf.rb:12:   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.


Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/curb-0.5.4.0 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/curb-0.5.4.0/ext/gem_make.out

Any ideas how I can get this to work?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Matt,

I've had trouble installing the curb gem in Windows before. In trying to see how others had solved this I came across a lot of questions and not very many solutions. Having to do it again tonight I decided to document my steps and post the results: http://beginrescue.blogspot.com/2010/07/installing-curb-with-ruby-191-in.html

Sorry for the blogspam, hope this is useful for somebody.

pete


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...