gpt4 book ai didi

Rails 上的 MySQL Gem 安装错误

转载 作者:太空宇宙 更新时间:2023-11-03 12:24:16 24 4
gpt4 key购买 nike

我正在使用 Chef 部署我的 Rails 应用程序。而

gem install mysql

遇到以下错误,

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/opt/chef/embedded/bin/ruby extconf.rb checking for mysql_ssl_set()... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/opt/chef/embedded/bin/ruby --with-mysql-config --without-mysql-config /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in try_do': The
compiler failed to generate an executable file. (RuntimeError) You
have to install development tools first. from
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:461:in
try_link0' from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:476:in try_link' from
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:619:in
try_func' from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:894:in block in have_func'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in
block in checking_for' from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone' from
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in
open' from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone'
from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in
open' from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in postpone' from
/opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in
checking_for' from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:893:in have_func' from
extconf.rb:45:in
'

Gem files will remain installed in /var/www/project-name/releases/daf93f4783a7238e5a8198c1fd50e4e1de93f654/vendor/bundle/ruby/1.9.1/gems/mysql-2.9.1 for inspection. Results logged to /var/www/project-name/releases/daf93f4783a7238e5a8198c1fd50e4e1de93f654/vendor/bundle/ruby/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out An error occured while installing mysql (2.9.1), and Bundler cannot continue. Make sure that gem install mysql -v '2.9.1' succeeds before bundling.

我正在使用 RHEL 6。我还有一本单独的 mysql 安装说明书。我尝试使用 yum 命令手动安装 Mysql。

我试过了

yum install mysql-devel and then run the gem install mysql

还是不行。谁能帮帮我。

谢谢

最佳答案

听起来你没有编译器。在 debian/ubuntu 系统上,您可以获得编译和构建软件包所需的一切:

sudo apt-get install build-essential

在 Fedora/Red Hat 上我认为应该是:

sudo yum groupinstall "Development Tools"

关于Rails 上的 MySQL Gem 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18367287/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com