veHi,
I'm trying to install Rails 3.0 with Ruby 1.9.2. on a Linux box. I'm behind a firewall and do not have root access on my machine so I'm trying to build everything in my home directory. I don't have access to apt-get or yum - I have to build everything from source (except for gems).
I've successfully compiled and built Ruby, Rails, and MySQL. My problem is that rails can't find the libmysqlclient.so.15 library. I've tried every conceivable option to "gem install mysql2" to tell it where the library is, with no luck. Note that if I have the local mysql/lib directory in my LD_LIBRARY_PATH, everything works. I just can't figure out how to tell mysql2 where the library is. Can someone help?
Thanks,
Stan McFarland
I'm sure you must also install the mysql-dev packages.
The file libmysqlclient_r.so.15 is in the mysql shared-compat package. The example below is using a specific mirror and it's for 32 bit generic linux. You can find the right package for your platform at http://dev.mysql.com/downloads/mysql/
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-shared-compat-5.5.13-1.linux2.6.i386.rpm/from/http://mysql.mirrors.pair.com/
$ yum install --nogpgcheck MySQL-shared-compat-5.5.13-1.linux2.6.i386.rpm
That default installation path is the same that the mysql2 gem used.
On OS X, I know I always have to update the library location in the gem manually. That same trick should work fine on linux. Adjust names and paths to match your platform:
$ sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.rvm/rubies/ruby-1.8.6-p399/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Related
When I try running rails console I get this error:
/Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require':
dlopen(/Users/TuzsNewMacBook/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/x86_64-darwin18/readline.bundle, 9):
Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
A quick search got me to this post and I've tried a few things:
brew reinstall postgresql (this is indeed the DB for this project)
and
cd /usr/local/opt/readline/lib
ln libreadline.8.0.dylib libreadline.6.2.dylib
(my version of readline is 8)
and
brew link readline --force
But none of these have fixed it.
I recently added pry-coolline, guard and guard-livereload gems to my project if that makes any difference (rails console loaded fine before those). I'm running on the latest macos.
(Update) I’m using pry rails as my rails console, if that makes any difference.
Any help? Thanks.
the error seems to be thrown when searching for /usr/local/opt/readline/lib/libreadline.7.dylib.
Have you tried to symlink that?
So something like:
cd /usr/local/opt/readline/lib
ln -s libreadline.8.0.dylib libreadline.7.dylib
Just tried that on macOS Mojave, ruby 2.5.3p105 and Rails 5.2.2 and worked.
Reinstalling my Ruby version seems to have fixed it:
rvm reinstall 2.3.7
can you try
cd /usr/local/opt/readline/lib
ln -s libreadline.8.dylib libreadline.7.dylib
you are on the right track but it seems like rails is looking for libreadline.7.dylib and libreadline.7.dylib is not there in the folder.
Yes, the best answer is to reinstall.
You can get the version easily by typing:
ruby -v
With rbenv, the command is i.e.:
rbenv install 2.3.7
with rvm:
rvm reinstall 2.3.7
A very simple solution that doesn't involve rebuilding your RVM gemset OR sym-linking libraries.
Add to your Gemfile:
gem 'rb-readline'
If you are doing bundler groups
group :development do
gem 'rb-readline'
end
Then run
> bundle
Let me know if that doesn't work.
Most often in Ruby-applications, this is caused by gems that have extensions (the gems saying "Building native extensions.."), that are built using a specific version of, in this case, readline.
Basically, there are two solutions:
Either, you can symlink version 8 of the gem, to the version missing. This will work in many cases, but if backwards compatibility is broken, it will not.
Or, if the gem actually supports version 8, you can reinstall that specific gem, or "pristine" it by running gem pristine --all.
EDIT: In scope of your "what I've tried", reinstalling PostgreSQL, is also one of the binaries, built using a specific version, that may also require a rebuild, to work with a system library, such as readline.
Got this issue:
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.4.dylib
doing...
cd /usr/local/opt/mpfr/lib/
ln -s libmpfr.dylib libmpfr.4.dylib
did the trick for me for macOS Catalina
Background: This has happened when I tried to install tig, but I think this is a common issue that you may have that you need to manually link the installed software into the right path that another software wants.
If you can not find readline installed on your Mac, you should run
brew install readline
After you installed deadline, brew will ask you to link it. But actually you can not link by running
brew link readline
Even you can not link by running
sudo brew link readline
Mac OS will warn you this is extremely dangerous and stop you to do.
The Latest version of readline is version 8, so you will see the error message like
Library not loaded: /usr/local/opt/readline/lib/libreadline.8.dylib
The brew installed deadline at
/usr/local/Cellar/readline/8.0.4
So you have to manually link it to the place that your software wants by using command ls
ln -s /usr/local/Cellar/readline/8.0.4 /usr/local/opt/readline
Enjoy!
So Ive checked a few answers here but I dont think they can work with a vanilla Mojave mac install. Im using 10.14.4 while I did these:
get homebrew from https://brew.sh
$ brew install coreutils : this installs the gnu coreutils pkg for mac, we want the greadlink from this because macOSX's readlink is not the same as the gnu readlink. Its extremely confusing but such is the life in macland.
$ echo 'alias readlink=greadlink' >> ~/.bash_aliases I found macs readlink to be a bit lacking so I overrode the existing readlink by aliasing greadlink. (you can make this usable by all users by $ alias readlink=greadlink >> /etc/bashrc which will enable every user to be able to use it.
$ ln -s /usr/local/opt/readline/lib/libreadline.8.dylib /usr/local/opt/readline/lib/libreadline.7.dylib I linked the already linked .8. file instead of '.8.0.' file because if it were to get updated to .8.1. then my readlink wont break or miss features on the library. Im pretty sure we will format our macs before 9+ comes out.
I would recommend against manually symlink'ing native libraries. Aas of OS X 10.4, the standard include library path /usr/include is no longer used and is locked by SIP (making it difficult to move things to).
Apple ships a “legacy installer” for you to be able to install the headers in the “old location”, which will also resolve your path to correctly find headers installed via brew.
cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop && open ~/Desktop/macOS_SDK_headers_for_macOS_10.14.pkg`
See here for a detailed write-up on what is going on.
My problem was just the same when running lftp.
Just running brew upgrade has solved my problem, as it has updated (among others):
readline 8.0.0_1 -> 8.0.1
lftp 4.8.4 -> 4.8.4_2
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
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 just libcurl.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
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 the PATH.
(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: the cygcurl-4.dll obtained from the current Curl Download Wizard
Renaming the above cygcurl-4.dll to libcurl.dlland putting it on the PATH
Installing the msys2 package libcurl-devel 7.57.0-1
Renaming the msys-curl-4.dll (from msys2 found at msys64\usr\bin) to libcurl.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
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
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.
None of the solutions worked for me - no matter what I tried, libcurl failed to load.
I then did the following:
Created a mini Ruby program that just tried loading the dll:
require 'ffi'
FFI::DynamicLibrary.open("libcurl", FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL)
Ran procmon and filtered by ruby.exe process and any path containing "dll"
As a result, I saw the following:
C:\Ruby27-x64\bin\libzstd.dll - NAME NOT FOUND
That gave me an idea that I was missing a dependency. The libzstd.dll file is part of the mingw-w64-x86_64-zstd package but luckily I just had it sitting on my drive elsewhere (as part of the GIMP installation).
I copied libzstd.dll to C:\Ruby27-x64\bin and the problem was solved. Of course, I had libcurl.dll in my path already (got it from https://curl.haxx.se/windows)
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.
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.
The solution which worked for me was download the dll, keep the exact name libcurl.dll and copy it to c:\windows\system32
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
I get the error:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
but all gems were successfuly installed:
gem 'ruby-debug-ide'
gem 'debase'
I can run 'rdebug-ide' manually:
$ rdebug-ide
Using ruby-debug-base 0.2.1
Usage: rdebug-ide is supposed to be called from RDT, NetBeans, RubyMine, or
the IntelliJ IDEA Ruby plugin. The command line interface to
ruby-debug is rdebug.
But when I start debugging, RubyMine asks to install the ruby-debug-ide gem. Why?
And, after installation I get:
Cannot start debugger. Gem 'ruby-debug-ide' isn't installed or its executable script 'rdebug-ide' doesn't exist.
I'm running Mac OS X 10.11.3.
Here's the actual command that worked for me:
gem install ruby-debug-ide --pre
Complementing Ahsan Ellahi
In your terminal you're probably not running the same ruby version as inside Ruby Mine. You can check this
In Ruby Mine
Preferences --> Laguanges and Frameworks --> Ruby SDK and Gems
In Terminal
$ ruby -v
If you're not running the same version, try to set RubyMine to use the same Ruby version that you're running in your terminal. This should solve the problem. Than, if you really want to use another RubyVersion, you will need to go to your terminal, change the Ruby version and manually install both gems
I have faced this issue when debugging in a docker-compose environment. I suspect that RubyMine does not refresh the list of available gem after the SDK is added.
So if you add the SDK then add ruby-debug-ide to Gemfile you will get the error.
Instead, (re)create the SDK after adding ruby-debug-ide.
I started getting this after upgrading from 2017.x to 2018.1. In my case, it seems that RubyMine needed a newer version but its error message implied it couldn't find any version and failed to install it. I think it was trying to install it with a different SDK.
Manually installing the latest ruby-debugger-ide (in my case the --pre flag was necessary) and then restarting RubyMine did the trick for me.
Since you're using Mac OSX, I couldn't provide the same exact answer for you, but you can find a similar way of achieving this. I'm using Ubuntu with Vagrant, so you may need to adapt it just a little bit.
Copy the following gem from RubyMine/rb/gems app folder, please copy the gem related to your ruby runtime and platform, there are different gems for different ruby runtime and platforms, in my case, its:
debase-0.3.0.beta7.gem
ruby-debug-ide-0.8.0.beta6.gem
Install them inside your app host, in my case its vagrant, in your case it could be inside your container, or in your host OS using the following command:
gem install --force --local *.gem
Set breakpoint and start debugging.
It may asks you one more time to install the gem, but then the debug will works for sure.
This worked for me
gem install debase-ruby_core_source
Source: Cannot install Rubymine Debugger
You should look into RubyMine settings, which ruby version and which gemset (global/default) it is using. Check out where these required gems are installed and make sure RubyMine is using that gemset where these are installed successfully.
I fixed this after viewing the responses here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206072049-Cannot-start-debugger
The solution at the bottom suggested 'removing all my gems. removing ruby. cleaning up directories and rvm. removing ruby mine, then reinstalling everything'
I started with the easiest of these, which was to reinstall rubymine. That solved it for me.
I had this issue on Windows 11 running Ubuntu on WSL2. To solve, I manually copied the relevant files in my %AppData% directory into the corresponding directory in Ubuntu.
I found all the data at:
C:\Users[USER]\AppData\Local\JetBrains\RubyMine[VERSION]\ruby_stubs\[NUMBER]\home\[USER]\.gem\ruby\2.7.0
These files were copied to: \\wsl.localhost\Ubuntu\home\[USER]\.gem\ruby\2.7.0
After doing this, everything worked again.
I have faced this issue too with Rubymine 8, rvm 1.29.1 and Ruby version 2.3.3 And upgrading the Rubymine version from Rubymine 8 to Rubymine 2016.3 or latest resolves the issue for me.
Check ruby SDK's version is right.You can first using rails installer to install everything .
Then using gem to install rdebug for ruby 2+.
Make sure Rubymine's Ruby version is same to which you have installed.With those all done,you will be able to debug ruby.
Please check x286 vs 64 version, both Ruby and Rmine version. I had this problem runnin x86 rubyMine on 64 ruby
A combination of matching the host ide ruby version with the remote SDK version worked for me but required a few additional steps. I too am running mac os as my host (running mohave)
the remote environment setup in preferences -> ruby sdk and gems must have the same version as the remote target, including any gems installed.
NOTE: I had to re-install the bundler gem on both host and remote host to get the gem manager to install things auto-majically.
the project environment must be changed to use the same version as the remote host as well. this is in File -> preferences for new projects -> ruby sdk and gems.
NOTE: I also had to set the default RVM on my local host and remote host and unset the previous version as default in the local host preferences.
Once I did this I was able to get gems in sync and remote debugger to connect.
My solution was to go to Rubymine settings, to the available SDKs,
remove the SDK, restart Rubymine and add the SDK again.
Running Ubuntu 18 something, RubyMine version 2020.3. Had this issue. None of these suggestions worked for me, same error no matter what did. I was using RVM, and ruby 2.6 and 2.7, switched back and forth a cleaning and reinstalling gems along thew way, both debase and ruby-debug-ide were installed according to the gem list. Settings in rubymine matched "ruby -v" from the command line. VSCode worked perfectly with this setup.
In the end i removed RVM and all the ruby versions, installed ruby via rbenv, installed ruby 2.6.5 and that worked like a charm.
I think this error is generated for multiple reasons with no real way to figure out which reason for your specific instance. I would like to encourage jetbrains to generate more debug information on errors like this, or if you are generating error information, point out where it is when this happens.
Try these steps:
1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. brew install ruby
3. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
if you get unshallow error on any step then first try:
1. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
2. git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
3. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4. brew install ruby
5. echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
Lastly restart the terminal and check .bash_profile:
- nano ~/.bash_profile
If you see the path variable, just close it. Otherwise it means something went wrong :/.
The last step is to open
RubyMine -> Preferences -> Language and Frameworks -> Ruby SDK and Gems -> select the newest ruby version and apply.
You may need to update ruby version from the gemfile.
And it should be done!
I am trying to use IMGKit gem.
So I need to install wkhtmtopdf software.
The following command doesn't work: sudo imgkit --install-wkhtmltoimage , so I am trying to install it manually.
I downloaded two versions for Mac: one is a .i386 file and the other are 4 .dylib files.
How can I install any of them?
Why they dont have a normal installer?
.i386 file can be copied directly to /usr/local/bin and I had to make it executable chmod u+x NAMEOFTHEFILE.i386
You may want to give Homebrew a gander. It simplifies the process of installing many tools and libraries on OSX.
Is there a way to get geoip_city, the Ruby gem, running on Windows?
Have you read the documentation?? I found the following instructions there:
Install
Some variation of the following should work.
Install the GeoCity C library. You can get it from here www.maxmind.com/app/c For example, I like to install mine in /opt/GeoIP so I do this:
tar -zxvf GeoIP-1.4.3.tar.gz
cd GeoIP-1.4.3
./configure --prefix=/opt/GeoIP
make && sudo make install
Now install the geoip_city gem
sudo gem install geoip_city -- --with-geoip-dir=/opt/GeoIP
Download the GeoLite City database file in binary format from: www.maxmind.com/app/geolitecity Maybe this direct link will work: www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz I put this file in /opt/GeoIP/share/GeoIP/GeoLiteCity.dat
Use it!
On Windows, the gem installs like any other gem:
gem install geoip_city -- --with-geoip-dir=/opt/GeoIP
Just make sure that ruby\bin directory is in your path or you run the above command from the ruby\bin directory.
But the required MaxMind library and database takes a little more work. You will need an application that can uncompress tar.gz files such as 7zip. The link to the MaxMind library specifically mentions Windows installation instructions are contained in the archive.
The database is just a binary file, so once you've uncompressed it you're good to go.