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.
Related
I've read a ton about how El Capitan's SIP messes up brew, ruby, and it's gems. The most recent thing I read is that brew was updated to better support El Capitan, so I followed a number of commands from an article online and apparently cleaned my whole system up and reinstalled all gems. Now, from terminal, everything works great. I don't have to write anything special to install gems... just gem install <name>.
However, SublimeText seems to be using a different Ruby. If I type which ruby, it shows as /usr/local/bin/ruby. But in SublimeText, it's showing this error about not finding the right gem (mechanize in this case): /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire': cannot load such file -- mechanize (LoadError)`
I tried creating a different build system file for Ruby, which points to ruby at /usr/local/bin/ruby, but it still shows this error (but below, it shows [cmd: ['/usr/local/bin/ruby']...
This has also caused me major issues trying to get the shoes gem to install.
Long question shortened: is there a definitive way to clear my system of all past brew, ruby, gems, etc etc, and redo it in a proper way that actually works for El Capitan?
Checkout #paskal answer here: Ruby 'require' error: cannot load such file
Try changing require <file name> with require "./<File name>".
I'm trying to install Shoes on Ubuntu 12.04 64-bit and currently have Ruby 1.9.3 and 2.0.0 installed, with 1.9.3 as the default. I tried several different methods, running several different scripts, but nothing seems to be successful. I haven't gotten any error messages; The scripts just install a lot of libraries and then seem to build Shoes, and, though I now have a shoes directory full of files, when I try to execute /dist/shoes I get this error:
me#me-Studio-1735:~/shoes$ ./dist/shoes
<internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in `<compiled>'
uninitialized constant Encoding::UTF_7
These are the the steps I've taken, in order:
I downloaded the Shoes3 .run file from the official website, but when I tried to execute it, I get this output:
Verifying archive integrity... All good.
Uncompressing Shoes..................................................................................................................................................................................................................................................................................................................
./shoes-3.1.0.run: 1: eval: ./shoes: not found
I then attempted to follow the instructions for installing on Ubuntu; I ran the script they linked to, which took about 20 minutes, but afterwards I couldn't find the red-shoes directory: It didn't exist. All I got to show for it was a /tmp/shoes_build/ directory with a "chruby opt ruby-1.9.3-p392 ruby-build" directory listing.
Then I tried running the script from that same website listed directly on the site, not linked to. No Shoes. Lots of things were installed, but when I tried to execute /dist/shoes, I got the same error.
Finally, I tried executing the commands listed on the Spiral of Hope site listed under 'SUCCESS: Ubuntu?'. Again, it runs and installs lots of libraries, but Shoes isn't functional. It is neither a recognized command when typing shoes, nor can I execute anything successfully.
I don't know what else to do. I'm no Linux buff, I just have a knowledge of basic Bash commands, and I recently installed Ubuntu, so I haven't done any weird custom installs or anything. Can anyone tell me what I'm doing wrong, and how to do it right?
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:\ruby\lib\ruby\gems\1.8\gems\curb-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?
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
Ultimately, in win7 with ruby 1.9.1 the following worked for me (where paths need to be updated to reflect the location (and version) of your curl version (which can be obtained via http://curl.haxx.se/download.html#Win32))
gem install curb -- --with-curl-lib="C:/curl/curl-7.21.1-devel-mingw32/bin" --with-curl-include="C:/curl/curl-7.21.1-devel-mingw32/include"
This did take a few minutes to process, so be patient.
I used Evan's install config in his answer with the correct libcurl binary from the wizard: http://curl.haxx.se/dlwiz/
gem install curb -- --with-curl-lib="C:/curl/curl-7.21.1-devel-mingw32/bin" --with-curl-include="C:/curl/curl-7.21.1-devel-mingw32/include"
This worked for me on win XP 64 bit.
Make sure to select libcurl with the description about being the binary for libcurl software development.
Looking at the underlying issue you are trying to solve. I was looking for a multpart-post client before and spent a lot of time trying out diffrent gems/tools.
The only one i found that worked satisfactory was Nick Siegers multipart-post gem
It was very straightforward to use, I highly recommend it.
Here is sample code i made for my test
require "rubygems"
require 'net/http/post/multipart'
url = URI.parse('http://localhost:3000/mytest/1.xml')
File.open("c:/temp/readme.txt") do |jpg|
req = Net::HTTP::Put::Multipart.new url.path,
"mytest[attachment]" => UploadIO.new(jpg, "text/plain", "c:/temp/readme.txt")
res = Net::HTTP.start(url.host, url.port) do |http|
http.request(req)
end
puts res.inspect
end
As I commented already, I did find a solution which was simply using the rest-client provided in the github gems..
gem install rest-client
will get the job done.
From there you can do a multipart post which can contain 1 or more files.. It has all the flexibility one could need in a rest-client.
See the documentation here: http://rdoc.info/projects/archiloque/rest-client
for examples on how to use it.
The only thing I found that it didn't do correctly was parsing cookies. The cookies my company uses can have equal signs in the values and it doesn't parse them correctly. I had put in some hacks to get around the issue but eventually that came back to bite me.. So just the other day I started analyzing the code from Mechanize/WEBrick and was able to utilize the CookieJar from Mechanize to manage cookies from the rest-client.. Hopefully I can get the author of the rest-client to build this functionality into the rest-client so others won't have the same problems I had..
For Windows 8 the command was:
gem install curb -- --with-curl-lib=C:/Utils/curl-7.32.0-dev/lib64 --with-curl-include=C:/Utils/curl-7.32.0-dev/include
And it nearly installs. Now there are "undefined reference" warnings/errors
That works too, on Windows 10 x64:
gem install curb -- --with-curl-lib="C:/Users/WindowsVM/binaries/curl-7.40.0-devel-mingw64/lib64" --with-curl-include="C:/Users/WindowsVM/binaries/curl-7.40.0-devel-mingw64/include"
When you say you passed configuration options to extconf.rb, did you mean in the gem install command?
If not, I believe it would be something along the lines of
gem install curb -- --with-curl-dir=dir
It might be a different config option, but the -- is that bit you need to pass it configure options.
Execute Below command and its works
gem install curb --platform=mswin32
after a lots of time spending on it, I give up...
The answers given above don't work for me, and some of the "curl" links are broken, I can't even download from the official web-site.
what I want is quite simple: install curb gem on cygwin.
Now I switched to VirtalBox, and installed a Ubuntu server on it. then, I install it in 20 minutes without any problems.
So, People working under cygwin, let's switch to Virtual Machine!
I tried all of the solutions above and nothing worked, I gave up but luckily I later stumbled upon this post http://jooglar.com/edely/content/installing-libcurl-ruby-windows and the instructions there worked perfectly.
Here are the directions, in case the website goes belly up:
1. Download the "libcurl" version of the library
From http://curl.haxx.se/dlwiz/?type=lib
2. Install wherever, but the path cannot have spaces.
Be sure that when you unzip the file, you find the directories “bin” and “include”
3. Add the libcurl path (ending in /bin;) to the system PATH variable
WARNING: USE / INSTEAD OF \ in the PATH. No spaces allowed in the path. For example:
C:/curl/curl-7.26.0-devel-mingw32/bin;
4. Install the gem
WARNING: AGAIN, USE / INSTEAD OF \ in the PATH. See above.
Example command: gem install curb -- --with-curl-lib=C:/curl/curl-7.26.0-devel-mingw32/bin --with-curl-include=C:/curl/curl-7.26.0-devel-mingw32/include
[NB: Note the standalone -- before --with-..., this was a gotcha for me.]
At this point, it should work. It worked for me. If it doesn't, you could try the rest of the instructions:
If it does not work, copy the following .dll files to the ruby/bin directory and run again the previous command.
libcurl.dll
libssl32.dll
libeay32.dll
Also, if that does not work...update the DevKit and run again the previous command. Download the latest version and from a console go to the DevKit directory and run
ruby dk.rb install --force
Question 828421 asked similar question, but received only one real answer (update rubygems) and that attempt results in the same error.
Ruby version 1.9.1.p243 on Windows. Included Gem, version 1.3.5.
Never installed any gems before; never did any special config for this Ruby.
Ruby itself works, as does irb, and "gem" operates but can't do install (and maybe other ops).
Tried this (from a book):
gem install rspec
Got this:
ERROR: http://gems.rubyforge.org/ does
not appear to be a repository
ERROR: While executing gem ...
(Gem::RemoteFetcher::FetchError)
SocketError: getaddrinfo: The storage control blocks were destroyed.
(http://gems.rubyforge.org/yaml)
When I go to that URL (without "yaml") using MSIE7, I get a page titled "Gemcutter | awesome gem hosting" and have no problem wandering around that site. So I don't -think- it's a proxy problem (though this is all from inside corporate firewall/proxies/etc).
When I go to that URL -with- "yaml", it goes to "http://production.s3.rubygems.org/yaml" and shows what I assume is an update specification page, starting with this:
--- !ruby/object:Gem::SourceIndex
I didn't destroy any "storage control blocks". So what is preventing gem from installing a gem?
Web search shows MANY people having this same problem over a long span of time, but I have yet to see anyone say "It's because of THIS, so do THIS to fix it." Well, someone suggested updating "gem", but trying that gets same error.
Help please?
Your browser might be using system-wide proxy settings or some sort of automatic configuration. The gem command probably doesn't. I'm behind an university proxy and I can't install/update any gems normally, but can access everything with my browser. To install gems, I normally create a tunnel to my server so I can bypass the proxy server.
This might help you to configure the proxy settings for the gem command: How do I update Ruby Gems from behind a Proxy (ISA-NTLM)
Sample:
sudo gem install nifty-generators -p http://proxy:port
It works well.
If your proxy requires authentication, then use:
gem install --http-proxy http://USERNAME:PASS#HOST:PORT gem_name
This can "at times" mean that for some reason rubygems.org is down currently, and so your local "invisible proxy" is returning you a 404 or what not.
#Tomas Markauskas didn't work for me because i'm not behind a proxy. And I didn't find a solution anywhere, I tried disable my AV and firewall, didn't
This was the solution for me:
gem install rails -r -w -p
Hope this will help people with the same problem.
EDIT: I have Windows 7 64bit.
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