Macportified gem install mysql

Posted on 07/03/2008. Filed under: Technology | Tags: , , , |

So I finally decided to act upon this

WARNING: You're using the Ruby-based MySQL library that ships with Rails.
This library is not suited for production. Please install the C-based MySQL
library instead (gem install mysql).

message I kept getting on my new Macbook running Leopard 10.5.2.

I am using Macports’ MySQL5 port and of course the gem install failed with

ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/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... no
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.

Having not been in the mood to dig deeper into it myself I consulted mighty Google which promptly came up with this post over at Chrises Code Intensity Blog describing which flags need to be set to what to make this work:

sudo env ARCHFLAGS="-arch i386" gem install mysql -- 
--with-mysql-include=/opt/local/include/mysql5 
--with-mysql-lib=/opt/local/lib/mysql5 
--with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config

Easy! :)

Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: