[英]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
錯誤詳情
暫時增強 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.