我正在尝试使用Ruby 1.9.1(已安装DevKit)将ruby-audio gem from warhammerkid安装到Windows 7x64上。将libsndfile x64个文件放入C:\Program Files\Mega-Nerd\libsndfile
(libsndfile-1.dll
位于此目录中)。
当我尝试安装gem时,我得到以下内容(完整详情如下):
C:/Ruby/bin/ruby.exe extconf.rb
checking for sf_open() in -lsndfile... no
....
extconf.rb:8:in `<main>': You need to install libsndfile
(http://www.mega-nerd.com/libsndfile/) (RuntimeError)
您可以在GitHub repository上看到extconf.rb
的(简短)内容。失败的一行是:
unless find_library 'sndfile', 'sf_open'
如何调整gem或libsndfile安装以允许gem找到它?我已经尝试将'C:/Program Files/Mega-Nerd/libsndfile
放在传递给find_library
的路径中,效果不佳。
以下是详细的gem安装的完整输出:
C:\>gem install ruby-audio --verbose
GET http://rubygems.org/latest_specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
Installing gem ruby-audio-1.3.0
Downloading gem ruby-audio-1.3.0.gem
GET http://rubygems.org/gems/ruby-audio-1.3.0.gem
connection reset after 2 requests, retrying
GET http://rubygems.org/gems/ruby-audio-1.3.0.gem
302 Found
GET http://production.cf.rubygems.org/gems/ruby-audio-1.3.0.gem
200 OK
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/README.rdoc
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/Rakefile
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/LICENSE
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/lib/ruby-audio/buffer.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/lib/ruby-audio/sound.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/lib/ruby-audio/sound_info.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/lib/ruby-audio.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/buffer_spec.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/sound_info_spec.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/sound_spec.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/spec_helper.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/spec.opts
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/data/what.wav
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/data/what2.wav
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/spec/data/what.mp3
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/extconf.rb
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/ra_buffer.c
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/ra_sound.c
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/ra_soundinfo.c
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/rubyaudio_ext.c
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/ra_buffer.h
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/ra_sound.h
C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/ra_soundinfo.h
Building native extensions. This could take a while...
ERROR: Error installing ruby-audio:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
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
--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:/Ruby/bin/ruby
--with-sndfilelib
--without-sndfilelib
extconf.rb:8:in `<main>': You need to install libsndfile (http://www.mega-nerd.com/libsndfile/) (RuntimeError)
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.9.1/gems/ruby-audio-1.3.0/ext/gem_make.out
最后,这是mkmf.log
find_library: checking for sf_open() in -lsndfile... -------------------- no
"gcc -o conftest -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby/include/ruby-1.9.1/ruby/backward -IC:/Ruby/include/ruby-1.9.1 -I. -I/opt/local/include conftest.c -L. -LC:/Ruby/lib -L/opt/local/lib -L/usr/local/lib -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
"gcc -o conftest -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby/include/ruby-1.9.1/ruby/backward -IC:/Ruby/include/ruby-1.9.1 -I. -I/opt/local/include conftest.c -L. -LC:/Ruby/lib -L/opt/local/lib -L/usr/local/lib -lmsvcrt-ruby191-static -lsndfile -lshell32 -lws2_32 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))sf_open; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby/include/ruby-1.9.1/ruby/backward -IC:/Ruby/include/ruby-1.9.1 -I. -I/opt/local/include conftest.c -L. -LC:/Ruby/lib -L/opt/local/lib -L/usr/local/lib -lmsvcrt-ruby191-static -lsndfile -lshell32 -lws2_32 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { sf_open(); return 0; }
/* end */
--------------------