Forum: Ruby mysql gem fails to install using Ruby 1.9.1

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2009-03-28 05:04
(Received via mailing list)
I can't get the MySQL gem to install using Ruby 1.9.1.

> gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install mysql --
--with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()... yes
checking for mysql.h... yes
creating Makefile

make
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux
-I/usr/local/include/ruby-1.9.1/ruby/backward
-I/usr/local/include/ruby-1.9.1 -I. -DHAVE_MYSQL_SSL_SET
-DHAVE_MYSQL_H  -D_FILE_OFFSET_BITS=64  -I/usr/include/mysql
-DBIG_JOINS=1 -fPIC -fno-strict-aliasing -fPIC  -O2 -g -Wall
-Wno-parentheses  -o mysql.o -c mysql.c
mysql.c:6:21: error: version.h: No such file or directory
[...]
make: *** [mysql.o] Error 1

Gem files will remain installed in
/usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.7 for inspection.
Results logged to
/usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.7/gem_make.out


My Ruby is installed from source:

> ruby -v
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]


My MySQL is installed from packages:

> dpkg -l|grep mysql
ii  libmysqlclient15-dev              5.1.30really5.0.75-0ubuntu9
 MySQL database development files
ii  libmysqlclient15off               5.1.30really5.0.75-0ubuntu9
 MySQL database client library
ii  mysql-client-5.0                  5.1.30really5.0.75-0ubuntu9
 MySQL database client binaries
ii  mysql-common                      5.1.30really5.0.75-0ubuntu9
 MySQL database common files


My mysql_config exists and seems to work:

> /usr/bin/mysql_config
Usage: /usr/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/include/mysql  -DBIG_JOINS=1 -fPIC
-fno-strict-aliasing]
        --include        [-I/usr/include/mysql]
        --libs           [-Wl,-Bsymbolic-functions -rdynamic
-L/usr/lib/mysql -lmysqlclient]
        --libs_r         [-Wl,-Bsymbolic-functions -rdynamic
-L/usr/lib/mysql -lmysqlclient_r]
        --socket         [/var/run/mysqld/mysqld.sock]
        --port           [0]
        --version        [5.0.75]
        --libmysqld-libs [-Wl,-Bsymbolic-functions -rdynamic
-L/usr/lib/mysql -lmysqld -lwrap -lrt]


And finally, I have several version.h files:

> locate version.h
/usr/include/linux/version.h
/usr/include/linux/dvb/version.h
/usr/src/ruby-1.9.1-p0/version.h


If there's a better place to ask about this, please let me know.


Thanks,
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-28 13:58
Greg Donald wrote:
> I can't get the MySQL gem to install using Ruby 1.9.1.
>
>> gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
> Building native extensions.  This could take a while...
> ERROR:  Error installing mysql:
>         ERROR: Failed to build gem native extension.

sudo gem install??
Aad37b5f7116c8d1f547d23b37566032?d=identicon&s=25 Greg Donald (destiney)
on 2009-03-28 17:34
(Received via mailing list)
On Sat, Mar 28, 2009 at 7:58 AM, 7stud -- <bbxx789_05ss@yahoo.com>
wrote:
> Greg Donald wrote:
>> I can't get the MySQL gem to install using Ruby 1.9.1.
>>
>>> gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
>> Building native extensions.  This could take a while...
>> ERROR:  Error installing mysql:
>>         ERROR: Failed to build gem native extension.
>
> sudo gem install??

No.

> sudo su -

# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
This topic is locked and can not be replied to.