2

请帮我安装 ruby​​-audio 1.6.1

ruby 1.9.3p194(2012-04-20 修订版 35410)[i686-linux]

Libsndfile 1.0.25 已经安装。

这是日志:

gem install ruby​​-audio-1.6.1.gem 构建原生扩展。这可能需要一段时间... 错误:安装 ruby​​-audio-1.6.1.gem 时出错:错误:无法构建 gem 原生扩展。

    /usr/bin/ruby1.9.1 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... yes
checking for sf_open() in -lsndfile-1... no
checking for sf_open() in -lsndfile... yes
checking for SF_FORMAT_OGG in sndfile.h... yes
creating Makefile

make
compiling ra_buffer.c
ra_buffer.c: In function ‘ra_buffer_index_get’:
ra_buffer.c:277:1: warning: control reaches end of non-void function [-Wreturn-type]
ra_buffer.c: In function ‘ra_buffer_type’:
ra_buffer.c:214:1: warning: control reaches end of non-void function [-Wreturn-type]
compiling ra_soundinfo.c
compiling rubyaudio_ext.c
compiling ra_sound.c
ra_sound.c: In function ‘ra_sound_init’:
ra_sound.c:155:5: error: format not a string literal and no format arguments [-Werror=format-security]
ra_sound.c: In function ‘ra_sound_read_short’:
ra_sound.c:258:1: warning: unused variable ‘channels’ [-Wunused-variable]
ra_sound.c: In function ‘ra_sound_read_int’:
ra_sound.c:259:1: warning: unused variable ‘channels’ [-Wunused-variable]
ra_sound.c: In function ‘ra_sound_read_float’:
ra_sound.c:260:1: warning: unused variable ‘channels’ [-Wunused-variable]
ra_sound.c: In function ‘ra_sound_read_double’:
ra_sound.c:261:1: warning: unused variable ‘channels’ [-Wunused-variable]
In file included from ra_sound.h:6:0,
                 from ra_sound.c:1:
ra_sound.c: At top level:
ra_soundinfo.h:10:14: warning: ‘ra_soundinfo_allocate’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:11:14: warning: ‘ra_soundinfo_free’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:14:14: warning: ‘ra_soundinfo_valid’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:15:14: warning: ‘ra_soundinfo_frames’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:16:14: warning: ‘ra_soundinfo_samplerate’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:17:14: warning: ‘ra_soundinfo_samplerate_set’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:18:14: warning: ‘ra_soundinfo_channels’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:19:14: warning: ‘ra_soundinfo_channels_set’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:20:14: warning: ‘ra_soundinfo_format’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:21:14: warning: ‘ra_soundinfo_format_set’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:22:14: warning: ‘ra_soundinfo_sections’ declared ‘static’ but never defined [-Wunused-function]
ra_soundinfo.h:23:14: warning: ‘ra_soundinfo_seekable’ declared ‘static’ but never defined [-Wunused-function]
In file included from ra_sound.h:7:0,
                 from ra_sound.c:1:
ra_buffer.h:24:14: warning: ‘ra_buffer_allocate’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:25:14: warning: ‘ra_buffer_free’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:28:14: warning: ‘ra_buffer_init’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:29:14: warning: ‘ra_buffer_init_copy’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:30:14: warning: ‘ra_buffer_channels’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:31:14: warning: ‘ra_buffer_size’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:32:14: warning: ‘ra_buffer_real_size’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:33:14: warning: ‘ra_buffer_real_size_set’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:34:14: warning: ‘ra_buffer_type’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:35:14: warning: ‘ra_buffer_each’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:36:14: warning: ‘ra_buffer_aref’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:37:14: warning: ‘ra_buffer_index_get’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:38:14: warning: ‘ra_buffer_aset’ declared ‘static’ but never defined [-Wunused-function]
ra_buffer.h:39:13: warning: ‘ra_buffer_index_set’ declared ‘static’ but never defined [-Wunused-function]
cc1: some warnings being treated as errors
make: *** [ra_sound.o] Error 1


Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/ruby-audio-1.6.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/ruby-audio-1.6.1/ext/rubyaudio_ext/gem_make.out
4

2 回答 2

3

使用-Wno-error=format-security标志安装:

gem install ruby-audio -- --with-cflags=-Wno-error=format-security

我也遇到了这个问题(在 Ubuntu 13.10 上),我相信根本问题与这个链接的问题相同——默认编译器标志会引发安全错误。

在安装 gem 时传递-Wno-error=format-security编译器标志会忽略安全错误并允许您安装 gem。

于 2014-01-22T07:22:56.630 回答
0

修复该错误

ra_sound.c:155:5: error: format not a string literal and no format arguments [-Werror=format-security]

我用该行替换了(文件 ra_sound.c 第 155 行): if(snd->snd == NULL) rb_raise(eRubyAudioError, "fkn_error");

于 2013-11-16T05:47:46.733 回答