ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

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

2019-07-13 07:16:53  阅读:281  来源: 互联网

标签:mysql ruby-on-rails-3 gem ubuntu-11-04 mysql2


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

Ubuntu 11.04

Rvm 1.13.5

Ruby 1.9.3p194

Rails 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版本上含糊不清.

第二个问题:有没有人遇到过这个问题?在过去一年左右的时间里,我已经与mysql2 gem争夺了各种库问题,但这似乎有所不同.

感谢任何帮助.

BTW:恢复到MySql 5.1是一个有效的解决方案!

问候

彼得

解决方法:

或者只是apt-get install libmysqlclient-dev然后gem install mysql2

标签:mysql,ruby-on-rails-3,gem,ubuntu-11-04,mysql2
来源: https://codeday.me/bug/20190713/1447208.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有