开发者

MySQL gem installation problem

I'm bit confused having error with MySQL gem installation. I have uninstalled mysql gem because of MySQL update from 5.0.xx to 5.1.39 and now I can't install it properly.

I have downloaded mysql-2.8.1.gem to the server, because it is behind proxy. I have rad a lot of tutorials where is told that I have to include mysql_config to get rid of this error, but there is no help from that.

OS is Red Hat Enterprise Linux Server release 5.3 (Tikanga).

[my@server ~]$ sudo gem install mysql-2.8.1.gem --no-rdoc --no-ri -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql-2.8.1.gem:
    ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile

make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H    -I/usr/include/mysql  -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC   -DUNIV_LINUX -DUNIV_LINUX -fPIC -g -O2   -c mysql.c
gcc -shared -o mysql_api.so mysql.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L.  -rdynamic -Wl,-export-dynamic    -rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto  -lrt -ldl -lcrypt -lm   -lc
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld开发者_如何学C: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [mysql_api.so] Error 1


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

Any suggestions?


From the error it looks as if your version of MySQL is not compatible with the version of the gem you are using.

/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient 
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient 
/usr/bin/ld: cannot find -lmysqlclient 

If you have multiple MySQL versions installed, maybe the gem is picking up on an older version. You should verify with the MySQL gem documentation for the verison you are using whihch version of MySQL is required.


I'd recommend that you use the mysql2 gem. If you use ruby 1.8 series you should use the gem version 0.2.11 or 0.2.13 something or if you use ruby 1.9 series I'd recommend gem version 0.3.7. 0.3.X does not work for some reason on ruby 1.8.

It should work like a charm. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜