2

Please help me to install ruby-audio 1.6.1

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

Libsndfile 1.0.25 already installed.

Here is log:

gem install ruby-audio-1.6.1.gem Building native extensions. This could take a while... ERROR: Error installing ruby-audio-1.6.1.gem: ERROR: Failed to build gem native extension.

    /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
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • possible duplicate of [Gem installation ruby-audio failing](http://stackoverflow.com/questions/14615596/gem-installation-ruby-audio-failing) – pdu Nov 13 '13 at 07:59

2 Answers2

3

Install with the -Wno-error=format-security flag:

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

I ran into this as well (on Ubuntu 13.10) and I believe the underlying issue is the same as in this linked question -- the default compiler flags will raise a security error.

Passing the -Wno-error=format-security compiler flag when installing the gem ignores the security error and allows you to install the gem.

Community
  • 1
  • 1
Ben Alavi
  • 392
  • 3
  • 7
0

To fix that error

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

I replaced (file ra_sound.c line 155) by that line: if(snd->snd == NULL) rb_raise(eRubyAudioError, "fkn_error");