Dav*_*Lee 2 ruby rubygems ruby-on-rails
我正在尝试让 Rails 项目在 M1 mac 上运行。我必须使用 ruby 2.6.2 和rails 5.2.3
我正在使用 rbenv 1.1.2 和 homebrew 3.0
当我运行时bundle install,我收到此错误
An error occurred while installing ruby-odbc (0.99999), and Bundler cannot continue.
Make sure that `gem install ruby-odbc -v '0.99999'` succeeds before bundling.
Run Code Online (Sandbox Code Playgroud)
然后我跑gem install ruby-odbc -v '0.99999'
这会导致另一个错误
ERROR: Error installing ruby-odbc:
ERROR: Failed to build gem native extension.
current directory: /Users/david.lee/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/ruby-
odbc-0.99999/ext
/Users/david.lee/.rbenv/versions/2.6.2/bin/ruby -I
/Users/david.lee/.rbenv/versions/2.6.2/lib/ruby/2.6.0 -r ./siteconf20210208-46271-1tguvxe.rb
extconf.rb
checking for version.h... no
checking for sql.h... no
*** 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
--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=/Users/david.lee/.rbenv/versions/2.6.2/bin/$(RUBY_BASE_NAME)
--with-odbc-dir
--without-odbc-dir
--with-odbc-include
--without-odbc-include=${odbc-dir}/include
--with-odbc-lib
--without-odbc-lib=${odbc-dir}/lib
ERROR: sql.h not found
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/david.lee/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/extensions/-darwin-20/2.6.0/ruby-odbc-0.99999/mkmf.log
Run Code Online (Sandbox Code Playgroud)
当我 stackoverflow 这个错误时,我收到这篇文章,告诉我要这样做brew install unixodbc,所以我这样做并再次尝试bundle install,这给了我同样的错误。
所有与未安装 sql.h 文件相关的 stackoverflow 帖子都不能解决我的问题。
我如何安装这个 Gem?
感谢同事的帮助,我解决了这个问题。您需要安装 gem,同时将其指向 unixodbc 目录
这是为我安装的生产线
gem install ruby-odbc -- --with-odbc-dir=/opt/homebrew/Cellar/unixodbc/2.3.9
要查找您的 unixodbc 路径,请运行brew info unixodbc
这将为您提供 unixodbc 的路径和版本号。然后将路径和版本号放在适当的位置
gem install ruby-odbc -- --with-odbc-dir=put your path and version number of unixodbc here
| 归档时间: |
|
| 查看次数: |
2492 次 |
| 最近记录: |