简体   繁体   English

在使用MySQL 5.6的CentOS 6.4 x64上mysql2 gem安装失败

[英]mysql2 gem installation failes on CentOS 6.4 x64 with MySQL 5.6

Trying to install mysql2 gem on CentOS 6.4 x64 with MySQL 5.6 installed with rpm. 尝试在安装了rpm的MySQL 5.6的CentOS 6.4 x64上安装mysql2 gem。

Getting this: 得到这个:

    Installing mysql2 (0.3.11)
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

            /usr/local/rbenv/versions/1.9.3-p448/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 mysql2_ext.c
    compiling result.c
    compiling client.c
    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
    linking shared-object mysql2/mysql2.so
    /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/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11 for inspection.
    Results logged to /usr/local/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

    An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
    Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.

EDIT: 编辑:

response from ldconfig -p | ldconfig -p的响应| grep mysql grep MySQL的

    libmysqlclient_r.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.16
    libmysqlclient_r.so.15 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.15
    libmysqlclient_r.so.14 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.14
    libmysqlclient_r.so.12 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.12
    libmysqlclient.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.16
    libmysqlclient.so.15 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.15
    libmysqlclient.so.14 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.14
    libmysqlclient.so.12 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.12

在做任何事情之前,我建议尝试一下:

sudo yum install mysql-devel

It seems it can't find the libmysql_r.so. 似乎找不到libmysql_r.so。 Either it isn't installed or the system can't find it because it is not properly configured. 由于未正确配置,因此未安装或系统找不到它。 Can you list the MySQL packages you have installed? 您可以列出已安装的MySQL软件包吗? Can you find the libmysqlclient_r.so on your system? 您可以在系统上找到libmysqlclient_r.so吗? Can you give us the output of the ldconfig -p|grep mysql ? 您能给我们ldconfig -p|grep mysql的输出吗?

If the libmysqlclient_r.so file is not there, you probably don't have the MySQL-client packages installed. 如果没有libmysqlclient_r.so文件,则可能没有安装MySQL客户端软件包。 If the proper packages are installed, the libmysqlclient_r.so can be found but it doesn't appear in the output of ldconfig -p , you can update the ldconfig cache by running ldconfig -v . 如果安装了正确的软件包,则可以找到libmysqlclient_r.so,但它不会出现在ldconfig -p的输出中,您可以通过运行ldconfig -v来更新ldconfig缓存。 It should pick up the library. 它应该拿起图书馆。 Then try to install the gem again. 然后尝试再次安装gem。

我也遇到了同样的问题,我通过rpm -ivh MySQL-shared-5.6.30-1.el6.x86_64.rpm解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM