I'm trying to install the curb gem on windows 7 with libcurl but it returns errors. This is for the eventual purpose of running a ruby app on a vm with vagrant, explained here github catarse install. but it returns an error saying:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing curb:
        ERROR: Failed to build gem native extension.

    C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe: invalid option -V  (-h will show valid
 options) (RuntimeError)

these are the versions I have used:

C:\>ruby -v
ruby 1.9.3p392 (2013-02-22) [i386-mingw32]

C:\>gem -v
2.0.3

C:\>vagrant -v
Vagrant version 1.2.2

So I've tried using http://beginrescue.blogspot.com.au/2010/07/installing-curb-with-ruby-191-in.html but there was an error and the make_gem.out file has a lot of these (as an example, I didnt think it necessary to post the whole file):

top:

C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-curl-lib=C:\curl-7.30.0-devel-mingw32\bin --with-curl-include=C:\curl-7.30.0-devel-mingw32\include
checking for curl-config... no
checking for main() in -lcurl... yes
checking for curl/curl.h... yes

bottom:

C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:454: undefined reference to `_imp__curl_free'
curb_postfield.o: In function `append_to_form':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:76: undefined reference to `_imp__curl_formadd'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:115: undefined reference to `_imp__curl_formadd'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\curb-0.8.4\ext/curb_postfield.c:120: undefined reference to `_imp__curl_formadd'
collect2: ld returned 1 exit status
make: *** [curb_core.so] Error 1
有帮助吗?

解决方案

I was getting the same lot of linker errors trying to install curb against the latest (at the time of this post) libcurl 7.32.0. Unfortunately, older versions that used to work for me before (e.g. 7.19.4) no longer include x86-mingw packages with the library and headers.

Here you can find a list of packages including libcurl 7.24.0 that can help you build the extensions. The first post also explains how to extract them and set up the environment. I was then able to install curb 0.8.5 with gem install curb -- --with-opt-dir=c:/path/to/libcurl.

其他提示

I finally got curb to install by using the source for curl, curl-7.36.0.zip, after having to compile the DevKit, DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe with Ruby200 on windows 7 32bit. curl-7.36.0-win32-fix1.msi with curl-7.36.0-win32-fix1.zip didn't work, nor the older curl-7.34.0-devel-mingw32.zip.

It has been a harrowing experience, googling the problems to have answers given by individuals that don't connect to closed issues, etc.

My stack: Windows 7, git bash 1.8.4.msysgit, ruby 1.9.3p484, rubygems 1.8.28

I got it to work doing the following (mostly mentioned at http://beginrescue.blogspot.com.au/2010/07/installing-curb-with-ruby-191-in.html)

  1. Install DevKit
  2. Download and extract curl-7.34.0-devel-mingw32.zip to C: drive, let's called this location CURL7_HOME.
  3. Add curl bin to the top of my PATH (something I missed the first time)
  4. Install curb: gem install curb -- --with-curl-lib=$CURL7_HOME/bin --with-curl-include=$CURL7_HOME/include

Note: --with-curl-lib=$CURL7_HOME/bin is not a typo. Setting it to bin directory makes it work. I've tried --with-curl-dir=$CURL7_HOME and --with-curl-lib=$CURL7_HOME/lib and those don't work.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top