【问题标题】:Gem installation ruby-audio failingGem 安装 ruby​​-audio 失败
【发布时间】:2021-04-06 19:52:02
【问题描述】:

我已经克隆了一个现有的存储库,现在正在运行 bundle install - 由于某种原因,它在 ruby​​-audio gem 中失败了。

Installing ruby-audio (1.6.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/thisuser/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for sndfile.h in /opt/local/include,/usr/local/include,C:/Program Files (x86)/Mega-Nerd/libsndfile/include,C:/Program Files/Mega-Nerd/libsndfile/include... no
checking for sf_open() in -lsndfile-1... no
checking for sf_open() in -lsndfile... 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
--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/thisuser/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-sndfile-dir
--without-sndfile-dir
--with-sndfile-include
--without-sndfile-include=${sndfile-dir}/include
--with-sndfile-lib
--without-sndfile-lib=${sndfile-dir}/lib
--with-sndfile-1lib
--without-sndfile-1lib
--with-sndfilelib
--without-sndfilelib
extconf.rb:26:in `<main>':   Can't find libsndfile (http://www.mega-nerd.com/libsndfile/) (RuntimeError)

  Try passing --with-sndfile-dir or --with-sndfile-lib and --with-sndfile-include
  options to extconf. If there are spaces in the path on windows, it may not work.

Gem files will remain installed in /Users/thisuser/.bundler/tmp/5253/gems/ruby-audio-1.6.1 for inspection.
Results logged to /Users/thisuser/.bundler/tmp/5253/gems/ruby-audio-1.6.1/ext/rubyaudio_ext/gem_make.out
An error occured while installing ruby-audio (1.6.1), and Bundler cannot continue.
Make sure that `gem install ruby-audio -v '1.6.1'` succeeds before bundling.

老实说,我不知道该怎么办。谷歌搜索显示与 mysql gem 相同的错误,解决方案是 mysql 特定的。

有没有人偶然发现过这个?如果没有,有没有办法明确告诉 Rails 忽略该宝石?从 gem 文件中删除它并再次运行 bundle install 并没有成功。

感谢您的帮助!

编辑

运行brew install libsndfile 后,我得到以下输出:

Warning: Your Xcode (4.5.2) is outdated
Please install Xcode 4.6.
==> Downloading http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
Already downloaded: /Library/Caches/Homebrew/libsndfile-1.0.25.tar.gz
==> Patching
patching file programs/sndfile-play.c
==> ./configure --prefix=/usr/local/Cellar/libsndfile/1.0.25
==> make install
make[1]: *** [sndfile-play.o] Error 1
make[1]: *** Waiting for unfinished jobs....
brew: superenv removed: -g -O2 -Wall -Wextra -Wdeclaration-after-statement -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite-strings -Wundef
brew: superenv removed: -g -O2 -Wall -Wextra -Wdeclaration-after-statement -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite-strings -Wundef
make: *** [install-recursive] Error 1
Your Xcode and or CLT are mis-configured. Try some or all of the following:
    xcrun --kill-cache
    xcodebuild -license
    sudo xcode-select -switch /path/to/Xcode.app

我尝试了所有建议的命令 - 无济于事。我还能做些什么来解决这个问题?

【问题讨论】:

  • 它说找不到libsndfile。通过 Homebrew 有一个 formula
  • 谢谢 - 不过不知道该怎么办?能详细点吗?
  • 安装Homebrew。运行brew install libsndfile。运行bundle
  • 请查看我的问题编辑。它给了我新的错误。
  • 您是否尝试过它建议您在最后运行的三个命令?

标签: ruby-on-rails rubygems


【解决方案1】:

所以,我们让它一起工作,我想我会分享我必须采取的步骤来完成这项工作。感谢所有评论的人!

  1. 问题是在安装 gem 时,找不到 libsndfile
  2. 要安装它,我必须运行 brew install libsndfile(如果您还没有自制软件,请先安装它),但没有成功,所以我不得不...
  3. ...更新Xcode到最新版本并安装Xcodes命令行工具(不要问我为什么,但我不得不这样做。)
  4. 然后我运行brew install libsndfile,它成功了
  5. 最后但同样重要的是,我再次运行 bundle install,它终于安装了所需的 gem。

【讨论】:

    猜你喜欢
    • 2011-05-06
    • 2013-05-06
    • 2018-12-31
    • 2021-07-17
    • 1970-01-01
    • 1970-01-01
    • 2023-02-22
    • 1970-01-01
    相关资源
    最近更新 更多