Rails 3.2.3 MySQL 5.5.1 Mysql2 gem 安装因 ld 不兼容而失败

2023-12-22

我有一个干净的构建系统,如下所示

乌班图11.04

RV1.13.5

红宝石 1.9.3p194

轨道3.2.3

宝石 1.8.24

MySql 5.5.24-1(安装在/usr/local)

我正在尝试安装 mysql2 gem (0.3.11) 并遇到以下问题:

 pal@smurf01:~$ sudo gem install mysql2
   [sudo] password for pal: 
   Building native extensions.  This could take a while...
   ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/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 client.c
   client.c: In function 'rb_raise_mysql2_error':
   client.c:98:3: warning: ISO C90 forbids mixed declarations and code
   client.c: In function 'rb_mysql_client_socket':
   client.c:590:3: warning: ISO C90 forbids mixed declarations and code
   compiling mysql2_ext.c
   compiling result.c
   linking shared-object mysql2/mysql2.so
   /usr/bin/ld: skipping incompatible /usr/local/mysql/lib/libmysqlclient_r.so when searching for -lmysqlclient_r
   /usr/bin/ld: skipping incompatible /usr/local/mysql/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/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
   Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
 pal@smurf01:~$

第一个问题:有人在 Ubuntu 上使用 MySql 5.5.1 运行 Rails mysql2 吗?我让它在另一个 5.1 系统上运行。在受支持的 MySql 版本上,gem 描述含糊不清。

第二个问题:有人遇到过这个问题吗?在过去的一年左右的时间里,我一直在与 mysql2 gem 的各种库问题作斗争,但这似乎有所不同。

如有任何帮助,我们将不胜感激。

顺便说一句:恢复到 MySql 5.1 是一个有效的解决方案!

Regards

Peter


Or just apt-get install libmysqlclient-dev进而gem install mysql2

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Rails 3.2.3 MySQL 5.5.1 Mysql2 gem 安装因 ld 不兼容而失败 的相关文章

随机推荐