Using curb gem and libcurl on Windows

梦想的初衷 提交于 2020-02-06 10:00:20

问题


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'


回答1:


Execute Below command for windows only and its works

gem install curb --platform=mswin32




回答2:


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:

  1. Get the 32-bit development version of curl (see my notes below)
  2. Add the curl bin directory to your PATH
  3. 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.


来源:https://stackoverflow.com/questions/3146858/using-curb-gem-and-libcurl-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!