Ruby Forum Ruby on Rails > MySQL Installation Issues

Posted by pete (Guest)
on 29.11.2007 18:33
(Received via mailing list)
Hello-

Trying to get rails up and running on my linux box with mysql.  When I
try to install the mysql gem, I get the following:

Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
    ERROR: Failed to build gem native extension.

ruby 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... yes
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/local/bin/ruby
        --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 /usr/local/lib/ruby/gems/1.8/gems/
mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/
gem_make.out

I've tried setting the config option and other various things when
running 'gem install'.

Anyone know how to get around this?  Thanks very much.
Posted by Greg Donald (destiney)
on 29.11.2007 18:40
(Received via mailing list)
On Nov 29, 2007 11:32 AM, pete <peterbattaglia@gmail.com> wrote:
> Trying to get rails up and running on my linux box with mysql.  When I
> try to install the mysql gem, I get the following:
>
> Building native extensions.  This could take a while...
> ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
>     ERROR: Failed to build gem native extension.

cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
gem install mysql -- 
--with-mysql-config=/usr/local/mysql/bin/mysql_config


--
Greg Donald
http://destiney.com/
Posted by pete (Guest)
on 29.11.2007 18:49
(Received via mailing list)
Thanks for the quick response.

No success with that either:

Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
    ERROR: Failed to build gem native extension.

ruby extconf.rb install mysql -- --with-mysql-config=/usr/local/mysql/
bin/mysql_config
extconf.rb:1: command not found: /usr/local/mysql/bin/mysql_config --
cflags
*** 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/local/bin/ruby
        --with-mysql-config


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/
mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/
gem_make.out
Posted by pete (Guest)
on 30.11.2007 17:06
(Received via mailing list)
This is still not working and I have tried almost every configuration
option possible.

As a side question...when you run 'gem install mysql', what exactly
does this do?

Does it create a binding to an already installed version of MySQL?
Does it install MySQL??

Thanks!
Posted by William Pratt (Guest)
on 30.11.2007 17:19
(Received via mailing list)
It compiles and installs a mysql driver used by ruby. You must have a
previously installed version of mysql including headers and libraries.

-Bill

pete wrote:
>
>> ruby extconf.rb install mysql -- --with-mysql-config=/usr/local/mysql/
>>         --without-opt-dir
>>
>>>> Trying to get rails up and running on my linux box with mysql.  When I
>>> Greg Donaldhttp://destiney.com/
>>>       
> >
>   

--
Sincerely,

William Pratt
Posted by pete (Guest)
on 30.11.2007 17:23
(Received via mailing list)
Thanks Bill.

Is there a dependency on the version of MySQL, I believe I am running
an older version.
Posted by William Pratt (Guest)
on 30.11.2007 17:44
(Received via mailing list)
It should work ok with 4.1or 5, but if I remember right, it recommends
5. I am using the latest 5 with no problems (5.0.45 I think).

-Bill

pete wrote:
>> -Bill
>>>       
>>>>         
>>>> necessary libraries and/or headers.  Check the mkmf.log file for more
>>>>         --without-make-prog
>>>> On Nov 29, 10:40 am, "Greg Donald" <gdon...@gmail.com> wrote:
>>>>> cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
> >
>   

--
Sincerely,

William Pratt
Posted by pete (Guest)
on 30.11.2007 18:12
(Received via mailing list)
What about MySQL client?  I don't believe the client is installed,
only the server.
Posted by William Pratt (Guest)
on 30.11.2007 18:35
(Received via mailing list)
It's very possible that it is looking for libmysqlclient (I am almost
positive it does). Install the client / client libs and see if that
solves your problem.

-Bill

pete wrote:
>>
>>>> It compiles and installs a mysql driver used by ruby. You must have a
>>>>> does this do?
>>>>>> No success with that either:
>>>>>> Could not create Makefile due to some reason, probably lack of
>>>>>>         --with-make-prog
>>>>>>             
>>>>>>>>                 
>>>>         
>> --
>> Sincerely,
>>
>> William Pratt
>>     
> >
>   

--
Sincerely,

William Pratt
Posted by Scott Hodson (shodson)
on 14.01.2008 03:54
Greg Donald wrote:
> On Nov 29, 2007 11:32 AM, pete <peterbattaglia@gmail.com> wrote:
>> Trying to get rails up and running on my linux box with mysql.  When I
>> try to install the mysql gem, I get the following:
>>
>> Building native extensions.  This could take a while...
>> ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
>>     ERROR: Failed to build gem native extension.
> 
> cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
> gem install mysql -- 
> --with-mysql-config=/usr/local/mysql/bin/mysql_config
> 
> 
> --
> Greg Donald
> http://destiney.com/

This fixed worked for me on OS X Tiger.  Thanks!  I have MySQL 5.0.45 
installed along with the MySQL GUI tools.