SSLv2 error with rails 3 on ubuntu 12 - ruby-on-rails-3

I m using ruby 1.9.2. Whenever i run bundle install, i get the following error.
bundle install
Fetching gem metadata from https://rubygems.org/.Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': /home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/i686-linux/openssl.so: undefined symbol: SSLv2_method - /home/prasad/.rvm/rubies/ruby-1.9.2- p320/lib/ruby/site_ruby/1.9.1/i686-linux/openssl.so (LoadError)
from /home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/openssl.rb:17:in `<top (required)>'
from /home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/prasad/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/net/https.rb:92:in `<top (required)>'
....
The things i tried to solve are
1) steps in answer at undefined symbol: SSLv2_method when running bundle install
2) steps by bob at https://groups.google.com/forum/?fromgroups=#!topic/hobousers/80wBJcS0IZk though the system had no x86_64-linux-gnu folder
3) steps in this blog http://awolf.ru/rails-on-ubuntu-with-rvm/
i cant understand why one of my machine works fine(upgraded from ubuntu 11.10 to 12.04)
while the other gives a problem(freshly installed ubuntu 12.04)
UPDATE:
the openssl version used by rvm on the working machine is 0.9.8 while the other one has 1.0.1. Some googling resulted that the 1.0.0 and 1.0.1 doent support the SSLv2 whereas it was supported by 0.9.8.
any fix for the above prob would be much appreciated.

Some distributions doesn't support SSLv2 due to security flaws. Make sure, you've removed any previous versions of RVM:
sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
Install RVM:
\curl -L https://get.rvm.io |
bash -s stable --ruby --autolibs=enable --auto-dotfiles

Related

Vagrant Rails shared folder bundler error

I am trying to move my development environment from my local machine to vagrant. I setup vagrant Ubuntu 14.04 amd64 box. I installed RVM, ruby, mysql, and many other requirements for rails development environment.
Finally i cd into rails root directory (which is shared with Windows 7 host) and run "bundle install", i get the error:
..
Resolving dependencies.....
Installing rake 10.1.1
Errno::EPERM: Operation not permitted # rb_sysopen - /vagrant/bin /rake
An error occurred while installing rake (10.1.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.1.1'` succeeds before bundling.
..
I have rails 3.2.17, ruby 2.2.1 and bundler 1.9.1.
I tried many different things such as chown /vagrant, remount with 777 mount_options, bundle install --path .bundle and so on, but none of them works.
Help me!
By the way this is the result of "bundle install --verbose"
..
Resolving dependencies.....
Using rake 10.1.1
0: rake (10.1.1) from /vagrant/.bundle/ruby/2.2.0/specifications/rake-10.1.1.gemspec
Errno::EPERM: Operation not permitted # rb_sysopen - /vagrant/bin /rake
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:175:in `initialize'
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:175:in `open'
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:175:in `block in generate_bundler_executable_stubs'
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:166:in `each'
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:166:in `generate_bundler_executable_stubs'
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:117:in `install_gem_from_spec'
/home/vagrant/.rvm/gems/ruby-2.2.1#global/gems/bundler-1.9.1/lib/bundler/installer.rb:263:in `block in install_sequentially'
..
I have finally found the solution. I think this is a bug in bundler. Bundler set the "BUNDLE_BIN" variable to 'bin ' (note the extra space) which causes the ruby code "File.open(binstub_path .." to throw error because ruby can not open "/vagrant/bin /rake" (note the extra space).
After i edited the ".bundle/config" file and set BUNDLE_BIN to 'bin' (removed space), "bundle install" worked fine.

Get Error: You must install at least one postgresql-client-<version> package when deploy to heroku

sdilshod#sdilshod-Lenovo-B590:~/webapp/saturn$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.6194
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2- 0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2- 0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Error: You must install at least one postgresql-client-<version> package.
rake aborted!
Error dumping database
/app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.2.12/lib/active_record/railties/databases.rake:415:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.2.12/lib/active_record/railties/databases.rake:188:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:182:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)
heroku pg:psql works fine, but when i do migrate rake db:migrate it get error that needs to install pg client. Where i need to install pg client? Any help
On a Debian based system the PostreSQL client programs are provided by postgresql-client-common as symbolic links to /usr/share/postgresql-common/pg_wrapper.
If you install that package and attempt to use any of the PostgreSQL client programs like psql, pg_dump, pg_dumpall, and pg_restore, the pg_wrapper without having the version specific binary package installed, like postgresql-client-9.1 it will emit this error:
You must install at least one postgresql-client-< version > package
The easiest way to fix this is to install the postgresql-client metapackage. It always depends on the currently supported database client package for PostgreSQL on Debian based systems and it depends on postgresql-client-common
sudo apt-get install postgresql-client
Update March 30th, 2020
Agree with the chosen answer, but I found to install postgresql-client-12 on a Ubuntu 18 slightly more involved.
sudo apt update
sudo apt -y install vim bash-completion wget
sudo apt -y upgrade
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-client-12
See this reference for details.
For Ubuntu 18.04.6 LTS it works with only two commands;
sudo apt-get install postgresql-client-common
and
sudo apt-get install postgresql-client
with new version postgresql 14, I follow up this document
http://apt.postgresql.org/pub/repos/apt/README
$ sudo su -
$ lsb_release -c
Codename: focal
$ echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-client-14

Can't install rmagick gem on Mountain Lion

Note: my situation is almost identical to this: Can't install pg gem on Mountain Lion.
I just upgraded from Snow Leopard to Mountain Lion and Rails is giving me all kinds of problems, especially trying to install the 'rmagick' gem. I'm running Ruby 1.9.3-p362 and Rails 3.2.11.
➜ git:(master) ✗ sudo gem install rmagick -v 2.13.1
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/opt/local/bin/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
/OPT/LOCAL/BIN/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
/USR/LOCAL/BIN/Magick-config reports version 6.8.0 Q16 is installed in /USR/LOCAL/Cellar/imagemagick/6.8.0-10
Using 6.6.6 Q8 from /opt/local.
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/sscirrus/.rvm/gems/ruby-1.9.2-p320/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
➜ applyco git:(master) ✗ brew install imagemagick --disable-openmp
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: imagemagick-6.8.0-10 already installed
➜ applyco git:(master) ✗ apt-get install libmagick9-dev
zsh: command not found: apt-get
I have tried:
Installing Xcode with command line tools
Reinstalling homebrew
Clearing out all my repo's gems (including Gemfile.lock) and running bundle install
Reinstalling the bundler gem
Reinstalling ImageMagick
Nothing, including answers elsewhere on SO, have been of any use. Can you point me in the right direction?
I had the same problem as you setting up my dev environment on Mountain Lion for RoR 3.2.11. Apparently the last version of RMagick (2.13.1 ) doesn't play nice compiling with the last version of ImageMagick (6.8.2-0). Disabling openmp and building from source worked like, ahem.. Magick.
brew uninstall imagemagick
brew install imagemagick --disable-openmp --build-from-source
gem install rmagick
I didn't need to edit the brew formula described in http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/, but that would be the next step to try.
I am going through the same issue here...
But one difference, maybe your homebrew its linked to another version of Imagemagick.
So even though imagemagick-6.8.0-10 is installed is not being found.
Try something like
brew unlink imagemagick
then brew link imagemagick
and see what happens.
This fixed my problem
http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
It may be a permissions issue try running
sudo chown -R `whoami` /usr/local
and then try again.
I had the same issue while trying to use Paperclip with Rails 3 for the first time.
Just to sum up previous answers, what worked for me was the following:
sudo chown -R `whoami` /usr/local
brew link --overwrite imagemagick
Thanks!

"sh: make: command not found" when running "$ bundle" after adding redcarpet gem to Rails app

I'm getting the following when running "$ bundle" after adding "gem 'redcarpet'" to Gemfile:
$ bundle
...
Using paperclip (2.3.11)
Using passenger (3.0.7)
Installing redcarpet (1.17.2) with native extensions /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/robs/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/robs/.rvm/gems/ruby-1.9.2-p180#rails-3.0/gems/redcarpet-1.17.2 for inspection.
Results logged to /Users/robs/.rvm/gems/ruby-1.9.2-p180#rails-3.0/gems/redcarpet-1.17.2/ext/redcarpet/gem_make.out
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `block in build_extensions'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `each'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `build_extensions'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180#global/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `block in install'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180#global/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
...
from /Users/robs/.rvm/gems/ruby-1.9.2-p180#global/gems/bundler-1.0.15/bin/bundle:13:in `<top (required)>'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180#rails-3.0/bin/bundle:19:in `load'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180#rails-3.0/bin/bundle:19:in `<main>'
Full gist here.
I am using rvm with different gemsets. This application is using the #rails-3.0 gemset. Here is my previous question regarding that setup.
I noticed the "Installing redcarpet (1.17.2)..." line includes "/Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb". Is this part of the problem? How can I get this to install?
Thanks.
Same issue aftering updating to Mountain Lion. You need to get the new command line tools and run:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Src: Upgrading to Mountain Lion and XCode 4 broke my "make"?
If after this you still get an error like this:
make: /usr/bin/gcc-4.2: No such file or directory
A symlink will sort out that issue:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
As one of the comments on this post states.
It might not be the best solution but it works, there's surely something else to it.
I had the same problems after a Time Machine update. Installing Xcode and the along coming developer tools fixed that issue.
If you have Mountain Lion and XCODE 4.4.1 you have to go here https://developer.apple.com/downloads/index.action and download the command line tool (it's free so you don't have to pay for iOS or MAC developer program) to download this tool.
It works for me.
FYI, you need to run the "Install Xcode" app if you downloaded it from the Appstore on a Lion in order to finish the install. Seems silly, but I missed it.
You simply need to install make!
RHEL-based:
yum install make
Debian-based
apt-get install make
I had the same problem after upgrading to OS X Lion. I updated X Code to 4.1 and everything was better!

bundle install problem: mysql.h is missing

in my mac OSX 10.6 32 bit, I can install mysql2 gem quite easily, but not in mini mac 10.6 64bit server.
I have installed MySQL 5.5.11 in troublesome server, while in my home mac MySQL 5.5.0.m2
Somehow when I run bundle install, in server it tries to install mysql2.0.3.2 while in home mysql2.0.2.6
Please don't tell me to
env ARCHFLAGS="-arch x86_64" sudo gem install mysql2 --version '= 0.2.6' -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I tried that, doesn't work.
Included /usr/local/mysql/bin in $PATH does not help as well.
Error code:
Installing mysql2 (0.3.2) with native extensions /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/administrator/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2 for inspection.
Results logged to /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.3.2/ext/mysql2/gem_make.out
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:511:in `block in build_extensions'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `each'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:486:in `build_extensions'
from /Users/administrator/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:159:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/source.rb:96:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:55:in `block in run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in `each'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/installer.rb:8:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in `install'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/bin/bundle:13:in `<top (required)>'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `load'
from /Users/administrator/.rvm/gems/ruby-1.9.2-p180/bin/bundle:19:in `<main>'
I tried all the solutions posted here, but was not lucky. I reinstalled mysql with homebrew a couple of times and still no luck. Then I came across a blog post with a solution.
I edited the mysql_config file in /usr/local/Cellar/mysql/5.6.12/bin and removed
the W-compiler options
-Wno-null-conversion and
-Wno-unused-private-field
for cflags and cxxflags.
This solved the problem with gem install mysql2 and bundle install
Reference: http://www.randomactsofsentience.com/2013/05/gem-install-mysql2-missing-mysqlh-on-os.html
I did a bundle install on a redmine repo and got the same error message :
mysql.h is missing. please check your installation of mysql and try again.
Running Fedora 16 64 bits, all I did was install mysql-devel (development package) from the distro rpm and the problem was solved!
So I think you could just
yum install mysql-devel
or apt-get the missing devel package.
for people who didn't use brew to install mysql and use mysql 5.6 and higher:
according to this answer
you need to edit mysql_config which was placed in my case here: /usr/local/mysql-5.6.12-osx10.7-x86_64/bin
and change cflags and cxxflags to:
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
after this manipulations
$ gem install mysql2 -v '0.3.13'
goes flawlessly
Ok guys for me the solution was:
$ sudo brew install mysql
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
source: http://wonko.com/post/how-to-install-the-mysqlruby-gem-on-mac-os-x-leopard
OR :
$sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
If your mysql version is 64Bits
After that i had a lot of problems because if i want to create the database:
$: bundle exec rake db:reset
i was receiving this error:
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Users/workdreamer/Sites/cavortify/implementation/cavortify/mysql/ruby/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /Users/workdreamer/Sites/cavortify/implementation/cavortify/mysql/ruby/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
The solution is: On your gemfile add: gem "ruby-mysql"
Ok, one day and a half to find the solution.
Have a nice day!
This method is for Rails 3.1.0 (and hopefully up) on 64 bit machine. I used on Ruby-1.9.2-p180.
This blog answered it: http://www.tatvartha.com/2010/10/installing-mysql-gem-with-bundler-on-snow-leopard/
Basically, the method above: $ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
may work, but without bundler.
To do it with bundler, first must run this on terminal:
bundle config build.mysql2 --with-mysql-config=/usr/local/mysql/bin/mysql_config
Note "mysql2" not "mysql" as shown in that blog.
That adds a config to ~/.bundle/config file
Then add this to ~/.bash_profile:
export ARCHFLAGS="-arch x86_64"
That is the same with telling bundler to run the command on top of this post.
The only way I could get this to work was to install the x64 version of mysql. I just used the .dmg located here http://dev.mysql.com/downloads/mysql/ and it worked like a charm. Wish I could get the 4 hours back it took to figure this out.
This worked for me on my Mac OSX Lion:
sudo env ARCHFLAGS="-I/usr/local/include/mysql/mysql -pipe -fPIC -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/lib/mysql/mysql --with-mysql-include=/usr/local/include/mysql/mysql --with-mysql-config=/usr/local/bin/mysql_config
This blog answered it.
My problem was the result of first installing MySql via the downloadable binary. It was originally installed at version 5.5.28. I then attempted to install via homebrew. Brew installed version 5.6.x. HOWEVER in the process of installing via homebrew, the symlink for /usr/local/mysql was still pointed to 5.5.28.
Update your symlink to whichever version was installed via homebrew.
ex: /usr/local/mysql -> /usr/local/Cellar/mysql/5.6.13/
This could be just part of the solution.
For mariadb:
sudo apt-get install libmariadbclient18 libmariadbclient-dev
Then
gem install mysql2
could be successfully installed.
Verify that gcc is installed. If it isn't, you will get that same error message.
You can check the results/log file it mentions for more clues as to the cause.
Posting this wherever I can--hopefully it will help someone and save them a lot of time.
I dug through 2 days worth of the internet and Stack Overflow, and it wasn't until I found this link and then starting working through this ticket for mysql2 that I actually resolved the issue.
With my setup (as explained in the ticket), the compiler switches of -Wno-null-conversion -Wno-unused-private-field would break and give me an error that wasn't exactly correct, which was:
mysql.h is missing. please check your installation of mysql and try again
For those on Fedora 21, and you already installed mysql-devel:
yum install redhat-rpm-config
solved the problem for me. see:
redhat docs
TL;DR:
sudo ln -s /usr/local/opt/mysql#5.6 /usr/local/mysql
I got stumped by this issue for almost 2 days and reinstalled xcode and mysql so many times.
I originally had mysql#5.6 installed using brew, but the bundle install command kept failing because it could not find a mysql installation. Error output below:
libmysqlclient is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.
However, using #Kevin Boedigheimer's answer helped fixed the problem i.e. I linked the installed mysql#5.6 to /usr/local/mysql
sudo ln -s /usr/local/opt/mysql#5.6 /usr/local/mysql
N.B: In case your mysql directory is somewhere else, you can find it using:
find / -name 'mysql*5.6' 2&> /dev/null
# '2&> /dev/null' ensures you have just the output you need