MySQL Gems install problems

Hi,

I'm having problems installing the MySQL Gem from both the Rubymine IDE and from the command line on Ubuntu 9.04. If I use:

$ sudo gem install mysql

then the following error gets thrown:


Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.



/usr/bin/ruby1.8 extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... 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
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib




Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql-2.7/gem_make.out



In the Rubymine IDE in the 'Setting' -> 'Ruby SDK and Gems' window I get presented with message saying 'Gems required for project are missing: MySQL' with an associated Install-now button; Clicking this button results in the exact same error but shown in a message box instead. I've read a fews posts with suggested solutions for this problem but none of them are working for me. Anyone any ideas??

FYI my Gem 'env' is:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.1
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /var/lib/gems/1.8
     - /home/rob/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/



I'm fairly new to Linux and so this is probably user error....


Thanks, Dex

4 comments
Comment actions Permalink

necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Hello,

Have check mkmf.log file? I think some packages are missed thus rubygems wasn't able to compile gem from sources

0
Comment actions Permalink

Hi Roman,

Fixed it! I couldn't find the mkmf file before for some reason. The problem was that the MySQL client library wasn't installed, so for anyone else with the same problem I needed to get it using (on Ubuntu 9.04) :

sudo apt-get install libmysqlclient15-dev

and then :

gem install mysql


Thanks for your help Roman :O)

Another quick question. I'm going through the help file and having a go at the topic 'Create and Run Your First Project' but I'm stuck at point 5 which says:

"Make sure that the required databases are available. First, launch your preferred database server. For example, in the Windows environment, you can launch the MySQL daemon from the command line, by typing mysqld.exe. Next, create databases required by the Rails application. To do that, right-click the editor or the contents pane of the Project tool window, point to the Rake node on the context menu, and choose db | create | all."

The last sentance doesn't make much sense to me. I don't see a 'contents pane' on the Project Tools window, I don't know where the context menu is supposed to be (or how a context menu can have nodes) and I don't see a db|create|all option anywhere, so I'm confused. Could you point me in the right direction please?

Thanks, Dex.

0
Comment actions Permalink

Hi Rob,

Another quick question. I'm going through the help file and having a go at the topic 'Create and Run Your First Project' but I'm stuck at point 5 which says:


"Make sure that the required databases are available. First, launch your preferred database server. For example, in the Windows environment, you can launch the MySQL daemon from the command line, by typing mysqld.exe. Next, create databases required by the Rails application. To do that, right-click the editor or the contents pane of the Project tool window, point to the Rake node on the context menu, and choose db | create | all."

If you want to play with Rails I recommend you to use sqlite3 database. It will be more easy and you shouldn't launch database server, etc. By default rails application generator will configure new rails application for using sqlite3. You should install some Ubuntu package for it and sqlite3 gem.

The last sentance doesn't make much sense to me. I don't see a 'contents pane' on the Project Tools window, I don't know where the context menu is supposed to be (or how a context menu can have nodes) and I don't see a db|create|all option anywhere, so I'm confused. Could you point me in the right direction please?

Here we mean to click inside Project View and look in context menu. But actually help here is a bit out of date. We dropped rake tasks from context menu and instead of it look at RubyMine | Tools | Run Rake task or RubyMine | Tools | Rake tasks

"db:create:all" rake task will ask MySQL to create corresponding databases (which are described in [your rails application]/config/database.yml. Or you can create databases manually using mysqladmin command..

0
Comment actions Permalink

Hello guys,

I've used instruction to install rails on Ubuntu 9.04 at:
http://mohamedaslam.com/install-ruby-on-rails-on-ubuntu-904-jaunty-jacklope/

Maybe can be useful for others.

Regards,
Oleg

0

Please sign in to leave a comment.