繁体   English   中英

尝试在 Ruby on rails 中安装 mysql 时出错

[英]Error while trying to install mysql in Ruby on rails

Ruby 版本- ruby 3.1.3p185(2022-11-24 修订版 1a6b16756e)[x64-mingw-ucrt]

Rails 版本- Rails 7.0.4

命令= gem install mysql2

我已经安装了 mysql 社区版并将 libmysql.dll 放在 C:\Ruby31-x64\bin

错误详情

暂时增强 MSYS/MINGW 的路径...使用 msys2 包:mingw-w64-ucrt-x86_64-libmariadbclient 构建本机扩展。 这可能需要一段时间...错误:安装 mysql2 时出错:错误:无法构建 gem 本机扩展。

 current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mysql2-0.5.4/ext/mysql2

C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/3.1.0 extconf.rb 检查 rb_absint_size()... 是检查 rb_absint_singlebit_p()... 是检查对于 rb_wait_for_single_fd()... 是在 ruby.h 中检查 rb_enc_interned_str()... 是 *** extconf.rb 失败 *** 由于某种原因无法创建 Makefile,可能缺少必要的库和/或标头。 检查 mkmf.log 文件以获取更多详细信息。 您可能需要配置选项。

提供的配置选项:--with-opt-dir --without-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:/Ruby31-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-mysqlclient-目录 --without-mysqlclient-dir --with-mysqlclient-include --without-mysqlclient-include=${mysqlclient-dir}/include --with-mysqlclient-lib --without-mysqlclient-lib=${mysqlclient- dir}/lib --with-mysqlclientlib --without-mysqlclientlib C:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:1083:in block in find_library': undefined method split' for nil:NilClass (没有方法错误)

 paths = paths.flat_map {|path| path.split(File::PATH_SEPARATOR)} ^^^^^^ from C:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:1083:in `each' from C:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:1083:in `flat_map' from C:/Ruby31-x64/lib/ruby/3.1.0/mkmf.rb:1083:in `find_library' from extconf.rb:103:in `<main>'

要了解此扩展编译失败的原因,请查看可在此处找到的 mkmf.log:

C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/mysql2-0.5.4/mkmf.log

extconf 失败,退出代码 1

Gem 文件将保留安装在 C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mysql2-0.5.4 以供检查。 结果记录到 C:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/mysql2-0.5.4/gem_make.out

此问题将通过安装解决

sudo apt-get install default-libmysqlclient-dev

暂无
暂无

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

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