# Mysql gem installation

**URL:** <https://www.ruby-forum.com/t/mysql-gem-installation/186159>\
**Category:** Ruby\
**Created:** [April 1, 2010, 10:06am UTC](https://www.ruby-forum.com/t/mysql-gem-installation/186159 "2010-04-01T10:06:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![juba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@juba](https://www.ruby-forum.com/u/juba)\
**Post date:** [April 1, 2010, 10:06am UTC](https://www.ruby-forum.com/t/mysql-gem-installation/186159/1 "2010-04-01T10:06:19Z")

</div>

Hi

I have recently installed a gentoo bootstrap prefix on os x, but when I  
want  
to install the mysql gem, I have this issue :

%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<

env ARCHFLAGS="-arch x86\_64" gem install mysql –  
–with-mysql-config=/usr/local/mysql/bin/mysql\_config  
Building native extensions. This could take a while…  
ERROR: Error installing mysql:  
ERROR: Failed to build gem native extension.

/opt/gentoo/usr/bin/ruby18 extconf.rb  
–with-mysql-config=/usr/local/mysql/bin/mysql\_config  
checking for mysql\_ssl\_set()… no  
checking for rb\_str\_set\_len()… no  
checking for rb\_thread\_start\_timer()… no  
checking for mysql.h… yes  
creating Makefile

make  
x86\_64-apple-darwin10-gcc -I. -I.  
-I/opt/gentoo/usr/lib/ruby/1.8/x86\_64-darwin10 -I. -DHAVE\_MYSQL\_H  
-D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE -I/usr/local/mysql/include -g -Os  
-arch x86\_64 -fno-common -D\_P1003\_1B\_VISIBLE -DSIGNAL\_WITH\_VIO\_CLOSE  
-DSIGNALS\_DONT\_BREAK\_READ -DIGNORE\_SIGHUP\_SIGQUIT  
-DDONT\_DECLARE\_CXA\_PURE\_VIRTUAL -fno-common -O2 -pipe -march=nocona  
-fno-strict-aliasing -fno-common -pipe -fno-common -c mysql.c  
cc1: erreur: option “-arch” de la ligne de commande non reconnue  
make: \*\*\* [mysql.o] Erreur 1

%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<

It seems that the -arch option is not recognized by my gentoo compiler.

So, I have tried to reproduce the gem process :

%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<

-\> gem fetch mysql  
-\> gem unpack mysql-2.8.1.gem  
Unpacked gem: ‘/Users/jbiard/tmp/mysql-2.8.1’  
-\> cd mysql-2.8.1/ext/mysql\_api/  
-\> /opt/gentoo/usr/bin/ruby18 extconf.rb  
–with-mysql-config=/usr/local/mysql/bin/mysql\_config

[ Here I have modified the Makefile generated to remove -arch option,  
and  
it works ! ]

-\> make && make install  
x86\_64-apple-darwin10-gcc -I. -I.  
-I/opt/gentoo/usr/lib/ruby/1.8/x86\_64-darwin10 -I. -DHAVE\_MYSQL\_H  
-D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE -I/usr/local/mysql/include -g -Os  
-fno-common -D\_P1003\_1B\_VISIBLE -DSIGNAL\_WITH\_VIO\_CLOSE  
-DSIGNALS\_DONT\_BREAK\_READ -DIGNORE\_SIGHUP\_SIGQUIT  
-DDONT\_DECLARE\_CXA\_PURE\_VIRTUAL -fno-common -O2 -pipe -march=nocona  
-fno-strict-aliasing -fno-common -pipe -fno-common -c mysql.c  
cc -dynamic -bundle -undefined suppress -flat\_namespace -o  
mysql\_api.bundle  
mysql.o -L. -L/opt/gentoo/usr/lib -L. -lruby18  
-L/usr/local/mysql/lib  
-lmysqlclient -lz -lm -lmygcc -ldl -lobjc  
/opt/gentoo/usr/bin/install -c -m 0755 mysql\_api.bundle  
/opt/gentoo/usr/lib/ruby/site\_ruby/1.8/x86\_64-darwin10

???

%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<%\<

Finally, the bundle is installed, but my gem is not yet installed. Could  
you  
tell me which steps I have to do to finalize my gem installation ?

Best regards,

Julien

---

<div class="post-metadata">

**Author:** ![juba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@juba](https://www.ruby-forum.com/u/juba)\
**Post date:** [April 1, 2010, 11:17am UTC](https://www.ruby-forum.com/t/mysql-gem-installation/186159/2 "2010-04-01T11:17:44Z")

</div>

Issue solved.

I have pasted an existant installation of mysql-2.8.1 gem directory into  
my  
gem path, then I have copied the bundle compiled into this directory and  
I  
have copied the gemspec file in my gem specifications path… And now it  
works !

2010/4/1 Julien B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
