Marek
Marek

Reputation: 7433

Continue installation of gem that breaks at certain point

I need to install mysql2 gem, but it breaks at linking with "ERROR: Failed to build gem native extension". It indeed uses incorrectly -lmysqlclient_r, while it should use -lmysqlclient.

So what I do:

$ cd /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2
$ vi Makefile # change -lmysqlclient_r to -lmysqlclient
$ make
linking shared-object mysql2/mysql2.so
$ cd ../../

What should I do now to continue the installation from this point?

Update: Running make install "worked" I think. however my ruby installation was so broken that I decided to start from scratch, this time with userspace install. After getting to the mysql2 installation:

$ make install
/usr/bin/install -c -m 0755 mysql2.so /data/web/rails/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2

$ rails server -d
/data/web/rails/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/resolver.rb:287:in `resolve': Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
...

Upvotes: 3

Views: 655

Answers (2)

Marek
Marek

Reputation: 7433

The answer is here: http://guides.rubygems.org/command-reference/#gem_install

Starting with "If you correct the compilation errors by editing the gem files you will need to write the specification by hand." follow the example.

Upvotes: 0

Samy Dindane
Samy Dindane

Reputation: 18706

After a make, you should do a make install.

Upvotes: 4

Related Questions