如何在 Redhat 4.0 上安装支持 mysql2 的 Rails 3.0?

发布于 2024-09-29 12:09:01 字数 4067 浏览 3 评论 0原文

当尝试在 Redhat 4.0 服务器上安装 Rails 3.0 时,“bundle install”在安装 mysql2 期间失败。

有可能解决这个问题吗?

“bundle install”命令返回以下输出:

~/rails/trial# bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.0) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.0) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.6.1) 
Using actionmailer (3.0.0) 
Using arel (1.0.1) 
Using activerecord (3.0.0) 
Using activeresource (3.0.0) 
Using bundler (1.0.3) 
Installing mysql2 (0.2.4) with native extensions /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

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

make
gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -I/usr/include/mysql -g -pipe -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fPIC -O3 -ggdb -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wall -funroll-loops  -o client.o -c client.c
In file included from ./mysql2_ext.h:29,
                 from client.c:1:
./client.h:41:7: warning: no newline at end of file
client.c: In function `set_reconnect':
client.c:434: error: `MYSQL_OPT_RECONNECT' undeclared (first use in this function)
client.c:434: error: (Each undeclared identifier is reported only once
client.c:434: error: for each function it appears in.)
client.c: In function `set_connect_timeout':
client.c:451: warning: passing arg 3 of `mysql_options' from incompatible pointer type
make: *** [client.o] Error 1

Gem 文件将保留安装在 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.4 中以供检查。

Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.4/ext/mysql2/gem_make.out
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/source.rb:100:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:55:in `block in run'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `block in each'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `each'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `each'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:44:in `run'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:8:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/cli.rb:221:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/task.rb:22:in `run'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor.rb:246:in `dispatch'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/base.rb:389:in `start'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/bin/bundle:13:in `<top (required)>'
 from /usr/local/bin/bundle:19:in `load'
 from /usr/local/bin/bundle:19:in `<main>'

When trying to install rails 3.0 on a redhat 4.0 server, the 'bundle install' fails during the installation of mysql2.

Is it possible to solve this?

'bundle install' command returns the following output:

~/rails/trial# bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.0) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.0) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.6.1) 
Using actionmailer (3.0.0) 
Using arel (1.0.1) 
Using activerecord (3.0.0) 
Using activeresource (3.0.0) 
Using bundler (1.0.3) 
Installing mysql2 (0.2.4) with native extensions /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

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

make
gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -I/usr/include/mysql -g -pipe -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fPIC -O3 -ggdb -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wall -funroll-loops  -o client.o -c client.c
In file included from ./mysql2_ext.h:29,
                 from client.c:1:
./client.h:41:7: warning: no newline at end of file
client.c: In function `set_reconnect':
client.c:434: error: `MYSQL_OPT_RECONNECT' undeclared (first use in this function)
client.c:434: error: (Each undeclared identifier is reported only once
client.c:434: error: for each function it appears in.)
client.c: In function `set_connect_timeout':
client.c:451: warning: passing arg 3 of `mysql_options' from incompatible pointer type
make: *** [client.o] Error 1

Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.4 for inspection.

Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.4/ext/mysql2/gem_make.out
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
 from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/source.rb:100:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:55:in `block in run'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `block in each'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `each'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `each'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:44:in `run'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/installer.rb:8:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/cli.rb:221:in `install'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/task.rb:22:in `run'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor.rb:246:in `dispatch'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/lib/bundler/vendor/thor/base.rb:389:in `start'
 from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.3/bin/bundle:13:in `<top (required)>'
 from /usr/local/bin/bundle:19:in `load'
 from /usr/local/bin/bundle:19:in `<main>'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风尘浪孓 2024-10-06 12:09:01

您是否安装了所有合适的开发库?例如 libmysqlclient-16-dev 或类似的东西?

Do you have all the appropriate development libraries installed? E.g. libmysqlclient-16-dev or something like that?

缪败 2024-10-06 12:09:01

是的,但我相信它太旧了?

~/rails/trial# rpm -qa|grep mysql
mysqlclient10-devel
mysqlclient10
mysql-devel
mysql-server
mysql

然而,就 RHEL4 而言,一切似乎都是最新的(并且升级并不是真正的选择)

~/rails/trial# up2date --showall|grep mysql
mysql-4.1.22-2.el4_8.3.x86_64
mysql-bench-4.1.22-2.el4_8.3.x86_64
mysql-devel-4.1.22-2.el4_8.3.x86_64
mysql-server-4.1.22-2.el4_8.3.x86_64
mysqlclient10-3.23.58-4.RHEL4.1.x86_64
mysqlclient10-devel-3.23.58-4.RHEL4.1.x86_64

~/rails/trial# /usr/bin/mysql_config
Usage: /usr/lib64/mysql/mysql_config [OPTIONS]
Options:
    --cflags         [-I/usr/include/mysql -g -pipe -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing]
    --include        [-I/usr/include/mysql]
    --libs           [-L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto]
    --libs_r         [-L/usr/lib64/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib64 -lssl -lcrypto]
    --socket         [/var/lib/mysql/mysql.sock]
    --port           [3306]
    --version        [4.1.22]
    --libmysqld-libs [-L/usr/lib64/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]

Yes, but I believe it is too old?

~/rails/trial# rpm -qa|grep mysql
mysqlclient10-devel
mysqlclient10
mysql-devel
mysql-server
mysql

However everything seems up to date as far as RHEL4 gets (and upgrading isn't really an option)

~/rails/trial# up2date --showall|grep mysql
mysql-4.1.22-2.el4_8.3.x86_64
mysql-bench-4.1.22-2.el4_8.3.x86_64
mysql-devel-4.1.22-2.el4_8.3.x86_64
mysql-server-4.1.22-2.el4_8.3.x86_64
mysqlclient10-3.23.58-4.RHEL4.1.x86_64
mysqlclient10-devel-3.23.58-4.RHEL4.1.x86_64

~/rails/trial# /usr/bin/mysql_config
Usage: /usr/lib64/mysql/mysql_config [OPTIONS]
Options:
    --cflags         [-I/usr/include/mysql -g -pipe -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing]
    --include        [-I/usr/include/mysql]
    --libs           [-L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto]
    --libs_r         [-L/usr/lib64/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib64 -lssl -lcrypto]
    --socket         [/var/lib/mysql/mysql.sock]
    --port           [3306]
    --version        [4.1.22]
    --libmysqld-libs [-L/usr/lib64/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文