# Symbol lookup error in mysql gem

**URL:** <https://www.ruby-forum.com/t/symbol-lookup-error-in-mysql-gem/91874>\
**Category:** Rails\
**Created:** [April 13, 2007, 12:27am UTC](https://www.ruby-forum.com/t/symbol-lookup-error-in-mysql-gem/91874 "2007-04-13T00:27:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![plambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@plambert](https://www.ruby-forum.com/u/plambert)\
**Post date:** [April 13, 2007, 12:27am UTC](https://www.ruby-forum.com/t/symbol-lookup-error-in-mysql-gem/91874/1 "2007-04-13T00:27:21Z")

</div>

I’ve been having a problem where the rails server (either WEBrick or  
Mongrel) hangs and becomes unresponsive overnight. I read some posts  
that caused me to think this might be an issue with Ruby’s MySQL  
driver, so I thought I would try the mysql gem. I ran:

gem install mysql --include-dependencies – --build-options --with-  
mysql-config=/depot/bin/mysql\_config

picked “mysql 2.7 (ruby)” (because I’m running on RedHat Linux) and  
got a message that the gem had successfully been installed.

However, as soon as my application tries to access the database, I get  
the following error (and Mongrel crashes):

ruby: symbol lookup error: /depot/packages/ruby-1.8.5-p2-bin/lib/ruby/  
gems/1.8/gems/mysql-2.7/lib/mysql.so: undefined symbol:  
\_intel\_fast\_memcpy

Does anyone have any idea what might be the cause? It seems odd that  
something would compile successfully, but then crash when running. I  
get the same error if I try to access the database from script/  
console.

```
   --Paul
```

---

<div class="post-metadata">

**Author:** ![plambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@plambert](https://www.ruby-forum.com/u/plambert)\
**Post date:** [April 13, 2007, 5:59am UTC](https://www.ruby-forum.com/t/symbol-lookup-error-in-mysql-gem/91874/2 "2007-04-13T05:59:43Z")

</div>

Paul E. G. Lynch wrote:

> console.  
> You have a version of MySQL compiled with the Intel compiler and the  
> Ruby MySQL library hasn’t been linked against the additional Intel  
> libraries. Here’s an example of how to fix this in Perl DBD::mysql:

[http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.modules/2006-08/msg00224.html](http://coding.derkeiler.com/Archive/Perl/comp.lang.perl.modules/2006-08/msg00224.html)

It might give you some ideas on how to fix it with Ruby.

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![plambert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/9d8465/32.png) [@plambert](https://www.ruby-forum.com/u/plambert)\
**Post date:** [April 23, 2007, 7:23pm UTC](https://www.ruby-forum.com/t/symbol-lookup-error-in-mysql-gem/91874/3 "2007-04-23T19:23:32Z")

</div>

Thanks-- this helped me to get the C-based mysql driver compiled and  
working. Also, it appears that the installation of this gem made the  
overnight-hang problem go away (though I have only had it running for  
about 36 hrs, so it is maybe a little early to be sure). In case  
anyone is having the same problem in getting the C-based mysql driver  
to work, here are the steps I took:

1. Install the mysql gem, e.g.:  
gem install mysql --include-dependencies – --build-options --with-  
mysql-config=/depot/bin/mysql\_config

2. Download the Intel CC libraries that were used to compile MySQL  
from:  
[http://dev.mysql.com/downloads/os-linux.html](http://dev.mysql.com/downloads/os-linux.html)  
(There is probably another page to use if you aren’t working on a  
Linux machine). You have to pick the libraries corresponding to your  
machine’s architecture, and also need to pick a version number (for  
which I used the latest and hoped for the best.) I unpacked these  
into:  
/depot/packages/intel-icc9-libs-9.0-i386

3. Manually edit the mysql gem Makefile. This file is actually  
generated during the installation, so this is not an ideal solution,  
but I couldn’t find a better one. The Makefile is in the top-level  
directory of the installed mysql gem, e.g.:  
/depot/packages/ruby-1.8.5-p2-bin/lib/ruby/gems/1.8/gems/  
mysql-2.7  
The change you need to make is to the LIBS variable in the makefile.  
You have to add a -L option to specify the location of the downloaded  
libraries, and then you need to add a -l option for the “irc”  
library. (I got this from the perl post Michael references;  
otherwise, it would have taken a lot of trial and error.) Here’s what  
my LIBS line looks like:

LIBS = -L/depot/packages/mysql/lib -L/depot/packages/intel-icc9-  
libs-9.0-i386 -lmysqlclient -lirc -lz -lcrypt -lnsl -lm -ldl -lcrypt -  
lm -lc

1. Run make and then “make install”.

2. Restart the web server (e.g. Mongrel).
