Problem to build gem mysql2

Hi,

I have installed OEL 5u8, ruby 1.9.3 p194 and MariaDB 5.5. When I trying to build gem mysql2 I got the following error:

[root@nic_prod_server ~]# ruby -v
ruby 1.9.3p194 (2012-04-20) [x86_64-linux]
[root@nic_prod_server ~]# gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
        ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
compiling result.c
In file included from ./mysql2_ext.h:39,
                 from result.c:1:
./client.h:42:7: warning: no newline at end of file
compiling client.c
In file included from ./mysql2_ext.h:39,
                 from client.c:1:
./client.h:42:7: warning: no newline at end of file
client.c: In function ârb_raise_mysql2_errorâ:
client.c:98: warning: ISO C90 forbids mixed declarations and code
client.c: In function ârb_mysql_client_socketâ:
client.c:590: warning: ISO C90 forbids mixed declarations and code
compiling mysql2_ext.c
In file included from ./mysql2_ext.h:39,
                 from mysql2_ext.c:1:
./client.h:42:7: warning: no newline at end of file
linking shared-object mysql2/mysql2.so
/usr/bin/ld: skipping incompatible /usr/lib/libmysqlclient_r.so when searching for -lmysqlclient_r
/usr/bin/ld: skipping incompatible /usr/lib/libmysqlclient_r.a when searching for -lmysqlclient_r
/usr/bin/ld: skipping incompatible /usr/lib/libmysqlclient_r.so when searching for -lmysqlclient_r
/usr/bin/ld: skipping incompatible /usr/lib/libmysqlclient_r.a when searching for -lmysqlclient_r
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1

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

What do I need to do in order to install the mysql2 gem?

Best regards,

Johan Tempelman
BT Global Services - BI System Support

Hey Johan,

Searching google for the first line of the error indicates that you are probably using MySQL <5.0. Is this true? If so, update MySQL to >5.0.

···

On Sep 4, 2012, at 1:31 AM, <johan.tempelman@bt.com> wrote:

In file included from ./mysql2_ext.h:39,

                 from result.c:1:

./client.h:42:7: warning: no newline at end of file