# Problems installing mysql-gem

**URL:** <https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269>\
**Category:** Rails\
**Created:** [April 30, 2007, 8:51am UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269 "2007-04-30T08:51:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [April 30, 2007, 8:51am UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269/1 "2007-04-30T08:51:57Z")

</div>

Hi.

I have been trying to install the mysql-gem with the inatllation  
instructions from hivelogic. After running the

sudo gem install mysql – --with-mysql-dir=/usr/local/mysql

I get the following error:

* * *

jekyll:/usr/local/src emil$ sudo gem install mysql –  
–with-mysql-dir=/usr/local/mysql  
Password:  
Select which gem to install for your platform (i686-darwin8.9.1)

1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation

> 3  
> 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-dir=/usr/local/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… yes  
checking for mysql\_ssl\_set()… yes  
checking for mysql.h… yes  
creating Makefile

make  
gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.9.1 -I.  
-DHAVE\_MYSQL\_SSL\_SET -DHAVE\_MYSQL\_H -I/usr/local/mysql/include  
-fno-common -g -O2 -pipe -fno-common -c mysql.c  
mysql.c: In function ‘query’:  
mysql.c:635: error: invalid storage class for function ‘res\_free’  
mysql.c:637: error: ‘res\_free’ undeclared (first use in this function)  
mysql.c:637: error: (Each undeclared identifier is reported only once  
mysql.c:637: error: for each function it appears in.)  
mysql.c: In function ‘Init\_mysql’:  
mysql.c:1299: error: ‘ulong’ undeclared (first use in this function)  
mysql.c:1299: error: parse error before numeric constant  
mysql.c:1302: error: parse error before numeric constant  
make: \*\*\* [mysql.o] Error 1

* * *

I currently have mysql 5.x installed. Does anyone of you know this  
error?

Thank you.  
Emil

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [April 30, 2007, 9:07am UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269/2 "2007-04-30T09:07:12Z")

</div>

Hola,

> Does anyone of you know this error?  
> I guess I do.

I bet you are on Ubuntu… Try this:

sudo apt-get install build-essential ruby1.8-dev

I am pretty sure you are missing at least one of these packages  
(According to the error, it seems ruby1.8-dev).

If this still does not help (but I am almost sure it will), just ping  
me, we will try to find out something.

Have a nice day,  
Peter  
\_\_  
[http://www.rubyrailways.com](http://www.rubyrailways.com) :: Ruby and Web2.0 blog  
[http://scrubyt.org](http://scrubyt.org) :: Ruby web scraping framework  
[http://rubykitchensink.ca/](http://rubykitchensink.ca/) :: The indexed archive of all things Ruby

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [April 30, 2007, 12:01pm UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269/3 "2007-04-30T12:01:07Z")

</div>

Hi Peter.  
Thank you for replying, im not using debian, im istalling on my os x  
intel-mac.

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [April 30, 2007, 7:54pm UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269/4 "2007-04-30T19:54:19Z")

</div>

On 4/30/07, Emil K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

In that case, I’d install ruby and rubygems using Macports. It’s a snap  
after that.

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [May 14, 2007, 1:25am UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269/5 "2007-05-14T01:25:40Z")

</div>

On 4/30/07, Emil K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi Peter.  
> Thank you for replying, im not using debian, im istalling on my os x  
> intel-mac.

i have always followed JDD’s sandboxing rails with macports instructions  
without issue:  
[http://blog.duncandavidson.com/2006/04/sandboxing\_rail.html](http://blog.duncandavidson.com/2006/04/sandboxing_rail.html)

cheers,  
jean-pierre

---

<div class="post-metadata">

**Author:** ![emuen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/96bed5/32.png) [@emuen](https://www.ruby-forum.com/u/emuen)\
**Post date:** [May 14, 2007, 1:23am UTC](https://www.ruby-forum.com/t/problems-installing-mysql-gem/93269/6 "2007-05-14T01:23:39Z")

</div>

I’m trying to install the mysql gem. I have mysql up and running,  
everything is up to date through yum in fedora, fc6.

[root@localhost ~]#  
[root@localhost ~]# gem install mysql -y  
Select which gem to install for your platform (i386-linux)

1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation

> 3

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 -y  
can’t find header files for ruby.

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/  
mysql-2.7  
for inspection.  
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem\_make.out  
[root@localhost ~]#  
[root@localhost ~]# cat /etc/fedora-release  
Fedora Core release 6 (Zod)  
[root@localhost ~]#  
[root@localhost ~]# date  
Sun May 13 08:01:18 BST 2007  
[root@localhost ~]#  
[root@localhost ~]#

thanks,

Thufir
