mysql - 错误:mysql gem 的捆绑安装失败
问题描述
提前抱歉我的英语不好。我正在尝试在 RoR 中安装 mysql,但是当我尝试时出现此错误:
Installing mysql2 0.4.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10/ext/mysql2
C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20191021-9148-s1v8ez.rb extconf.rb
--with-opt-dir=/usr/local/opt/openssl
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
checking for mysql_query() in -lmysqlclient... no
-----
mysql client is missing. Check your installation of MySQL or Connector/C, and
try again.
-----
*** 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=C:/Ruby25-x64/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/mysql2-0.4.10/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/mysql2-0.4.10 for inspection.
Results logged to
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/mysql2-0.4.10/gem_make.out
An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
mysql2
我已经在这里看到了所有的旧帖子,我尝试解决一些问题,但没有奏效。我已经安装了 ruby 2.5 和 Rails 5。我正在尝试安装 gem mysql2 -v '4.0.10'。你能帮我吗?
解决方案
它抱怨缺少mysql客户端试试这个命令
sudo apt-get install libmysqlclient-dev
然后重新启动你的mysql然后尝试捆绑
更多:如果您从头开始安装新应用程序,请点击此链接 https://gorails.com/setup/ubuntu/18.04#mysql
推荐阅读
- spring - spring 与 activemq 集成,池未打开
- python - ValueError:无法处理 Python/MySQL 中的参数
- javafx - JavaFx 自定义控件架构——处理焦点和关键事件
- sql-server - 在sql server中对给定数组进行排序
- javascript - 使用 jQuery 获取页面并提取具有特定类的所有链接
- php - PHP base_convert() 函数不能超过 6 字节
- javascript - 在 Node.JS 中使用 node-jose 进行加密和解密
- javascript - Flux:更新数组状态
- javascript - 如何使用 rxjs 进行自动保存?
- reactjs - 这有可能在 Scroll 上的 material-ui 选择列表中获得滚动位置吗?