seattlerb/image_science

Errors compiling under 1.9.3-preview1

tekwiz opened this issue · 7 comments

We are getting this error when trying to start our application with image_science under 1.9.3-preview1:

/home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb: In function 'with_image_from_memory':
/home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb:209: error: ISO C90 forbids mixed declarations and code
/home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb:222: error: ISO C90 forbids mixed declarations and code
/home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb: In function 'save':
/home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb:290: error: ISO C90 forbids mixed declarations and code
/home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/RubyInline-3.9.0/lib/inline.rb:590:in `build': error executing "gcc -shared -I/usr/local/include  -fPIC  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration  -fPIC -I /home/travis/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1 -I /home/travis/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/x86_64-linux -I /home/travis/.rvm/rubies/ruby-1.9.3-preview1/include -L/home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib -o \"/home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/x86_64-linux/.ruby_inline/Inline_ImageScience_1c7c.so\" \"/home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/x86_64-linux/.ruby_inline/Inline_ImageScience_1c7c.c\" -L/usr/local/lib -lfreeimage -lfreeimage -lstdc++ ": pid 12834 exit 1 (CompilationError)
Renamed /home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/x86_64-linux/.ruby_inline/Inline_ImageScience_1c7c.c to /home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/x86_64-linux/.ruby_inline/Inline_ImageScience_1c7c.c.bad
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/RubyInline-3.9.0/lib/inline.rb:828:in `inline'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb:90:in `'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bundler/gems/image_science-9b9ba4367f64/lib/image_science.rb:13:in `'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `require'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `each'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler/runtime.rb:66:in `block in require'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `each'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler/runtime.rb:55:in `require'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/bundler-1.0.17/lib/bundler.rb:120:in `require'
    from /home/travis/zerista/app/config/application.rb:34:in `'
    from /home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/travis/zerista/app/config/environment.rb:18:in `'
    from /home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/travis/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/travis/zerista/app/config.ru:1:in `block in '
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/rack-1.3.2/lib/rack/builder.rb:51:in `instance_eval'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/rack-1.3.2/lib/rack/builder.rb:51:in `initialize'
    from /home/travis/zerista/app/config.ru:1:in `new'
    from /home/travis/zerista/app/config.ru:1:in `'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/rack/adapter/loader.rb:36:in `eval'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/rack/adapter/loader.rb:36:in `load'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/rack/adapter/loader.rb:45:in `for'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/thin/controllers/controller.rb:169:in `load_adapter'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/thin/controllers/controller.rb:73:in `start'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/gems/thin-1.2.11/bin/thin:6:in `'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bin/thin:19:in `load'
    from /home/travis/.rvm/gems/ruby-1.9.3-preview1@zerista/bin/thin:19:in `'

Our workaround for now is to manually compile the failed file with only these switches (note, the differences in the -I switches are just because the come from different machines):

-c -fPIC -I/usr/local/rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1 -I/usr/local/rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/x86_64-linux

I'm not sure if this is is a configuration difference or a platform difference, but on Mac OS X (Lion), these errors are only warnings, and image_science successfully compiles; however, on ArchLinux, Gentoo, and Windows they are errors and the compile fails. The success of the compile varies on CentOS.

I ran into this problem too, on 64 bit Mageia Linux with gcc 4.5.2

Thanks for the work-around, I was able to manually compile the file, but I found I only had to remove the flag: -Werror=declaration-after-statement

I have a patch filed here:
http://rubyforge.org/tracker/?func=detail&atid=5923&aid=29474&group_id=1513

standalone patch:
http://bogomips.org/image_science.git/patch/?id=134695e8d17b197ade217

You can pull with the following command:

git pull git://bogomips.org/image_science.git master

(I never put repos on GitHub, I don't endorse GitHub)

Thanks Eric.

Best regards,

Fred

On Tue, Dec 13, 2011 at 12:01 PM, Eric Wong <
reply@reply.github.com

wrote:

I have a patch filed here:
http://rubyforge.org/tracker/?func=detail&atid=5923&aid=29474&group_id=1513

standalone patch:
http://bogomips.org/image_science.git/patch/?id=134695e8d17b197ade217

You can pull with the following command:

git pull git://bogomips.org/image_science.git master

(I never put repos on GitHub, I don't endorse GitHub)


Reply to this email directly or view it on GitHub:
#3 (comment)

I didn't have a reproduction at all... but it's applied.

Hi,

was this somehow solved in the current version of ruby 1.9.3? I'm getting a similar compilation error using image_science, I tried to apply the patch suggested by @nocode , and it couldn't find the files to patch (presumably because they have been corrected!?).

This is solved in image_science 1.2.2.

Ryan applied my patch as commit 7e4f9c1

@TiagoCardoso1983, if you're still having problems, please file a complete bug report.