Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling fails on Raspbian #7

Closed
rdvdijk opened this issue Aug 8, 2012 · 2 comments
Closed

Compiling fails on Raspbian #7

rdvdijk opened this issue Aug 8, 2012 · 2 comments

Comments

@rdvdijk
Copy link

rdvdijk commented Aug 8, 2012

I'm trying to compile ruby-audio on a Raspberry Pi running Rasbian, but compilation fails. Here is the error (full log below):

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]

Apparently format-security compiler flag is breaking the build. I have tried to compile with -Wno-format-security, but still the build fails with the same error.

Any idea how to fix this?


Here is the full log:

$ gem install ruby-audio
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-audio:
    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_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]
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]
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 /var/lib/gems/1.9.1/gems/ruby-audio-1.6.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ruby-audio-1.6.1/ext/rubyaudio_ext/gem_make.out
@rdvdijk
Copy link
Author

rdvdijk commented Aug 8, 2012

Ah, I just found the solution:

On row 155 of ra_sound.c, I have changed:

if(snd->snd == NULL) rb_raise(eRubyAudioError, sf_strerror(snd->snd));

to

if(snd->snd == NULL) rb_raise(eRubyAudioError, "%s", sf_strerror(snd->snd));

Now it compiles just fine. I'll make a pull request for this change.

@rdvdijk
Copy link
Author

rdvdijk commented Aug 8, 2012

See issue #8 and pull request.

@rdvdijk rdvdijk closed this as completed Aug 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant