问题
This is giving me a headache. I'm continuing a Rails project that started on Linux and I keep getting this when I run Puma on Ruby Mine:
Error:[rake --tasks] DL is deprecated, please use Fiddle
rake aborted!
LoadError: Could not open library 'libcurl': The specified module could not be found.
Could not open library 'libcurl.dll': The specified module could not be found.
Could not open library 'libcurl.so.4': The specified module could not be found.
Could not open library 'libcurl.so.4.dll': The specified module could not be found.
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/ffi-1.9.14-x86-mingw32/lib/ffi/library.rb:147:in `block in ffi_lib'
[...]
Now, what have I tried?
- I installed Puma successfully on Windows following this steps
- I downloaded
curl-7.50.1-win32-mingw
and put it on "C:/curl" - I added C:/curl/bin and C:/curl/include to PATH
- I installed successfully curb gem with
gem install curb --platform=ruby -- --with-curl-lib=C:/curl/bin --with-curl-include=C:/curl/include
- I put the .dll files in Ruby bin folder, installed the certificate in curl/bin and even run the curl.exe just in case.
I rebooted the machine but I keep seeing the same error.
I do not know what to do. How to successfully install libcurl on Windows for use with Rails
回答1:
I just had the same problem on Windows 7 x64 and answered about it here. (Similar to you, I tried a lot of things that I thought should work but didn't.)
What worked was:
To take a
libcurl.dll
from one of the packages found here, https://curl.haxx.se/download.html#Win64, and put it on thePATH
.(Link was updated, but originally pointed to version
7.40
)- I just put it under
\ruby24\bin\
- Maybe for you it's
C:\Ruby24-x64\bin
(Here are things I tried that didn't work:)
- Putting on the
PATH
: thecygcurl-4.dll
obtained from the current Curl Download Wizard - Renaming the above
cygcurl-4.dll
tolibcurl.dll
and putting it on thePATH
- Installing the
msys2
packagelibcurl-devel 7.57.0-1
- Renaming the
msys-curl-4.dll
(frommsys2
found atmsys64\usr\bin
) tolibcurl.dll
I didn't try building curl / libcurl from the latest source because I already have the latest according to
pacman -Ss libcurl
:msys/libcurl 7.57.0-1 (libraries) [installed] Multi-protocol file transfer library (runtime) msys/libcurl-devel 7.57.0-1 (development) [installed] Libcurl headers and libraries
More details about this in these other questions:
jekyll serve dependency error - Could not open 'lib curl'
Typhoeus Windows installation
Rails Typhoeus Curl Trouble
how to install libcurl on windows 7 64bit
回答2:
I had the same issue and tried the same steps that OP has listed. After breaking my head, cursing the existence of windows for some time and almost convincing the client to shift to a nix server I figured the libcurl.dll that I downloaded from https://curl.haxx.se/ (as suggested in all related posts) was corrupt.
Downloaded the one provided here http://www.dlldownloader.com/libcurl-dll/ and viola the ffi was able to load this one.
Hope this helps anyone else facing this issue
回答3:
Answer that worked for me (W10/Ruby2.6.0) was:
- Download cURL from the following URL: https://curl.haxx.se/windows/ (I chose 64bit because that's the system I'm using)
- Go into the archive and browse to
/bin
- Locate
libcurl_x64.dll
(it may be justlibcurl.dll
) - Extract to your local drive
- Rename it to
libcurl.dll
if it has the_x64
suffix - Cut + paste the file into the
/bin
directory of your Ruby installation
回答4:
For anyone running Ruby 2.5 on Windows, my solution was similar to the top solutions however I had to move it to place the file in both the \bin folder and \bin\ruby_builtin_dlls folder to work.
Some other things is that I downloaded the 64bit version and changed its name to libcurl.dll. Also make sure to restart your IDE/terminal and then try to start the server again.
回答5:
I want to use wpscan, but i get libcurl error OK, if you also get the same error, then in a very easy way I will try to give the solution.
Just copy the libcurl.dll file to system32 if your windows is 32 bit,
If your windows 64 bit copied to syswo64.
Good luck.
回答6:
Well, the issue is caused by a missing lib as said in the error, So the solution is to download the lib here: http://www.dlldownloader.com/libcurl-dll/ and navigate to the ruby folder under bin and drop it there make sure to rename the downloaded .dll file to this exact one: libcurl.dll else won't work even after.
回答7:
If you're using WSL on Windows 10 (Make sure to update to Ubuntu 16.04) the following instructions worked perfectly for me. You might need to completely wipe what you have installed however. Within bash:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev postgresql-client-common postgresql-client libpq-dev
And then to build our path and plugin directory for rbenv:
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
Finally we come to ruby:
rbenv install 2.4.1
rbenv global 2.4.1
Then bundler:
gem install bundler
rbenv rehash
Now our prerequisites:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
And then finally Rails:
gem install rails
rbenv rehash
来源:https://stackoverflow.com/questions/39377541/how-to-solve-libcurl-not-found-with-rails-on-windows