Subject:
[ruby-ffi] Re: "_FILE_OFFSET_BITS" redefined on OpenSolaris
From:
Henry Jen
Date:
1/31/10 1:49 AM
To:
ruby-ffi

BTW, I can fix the issue with attached patch, however, I am not
confortable with that. Maybe there is a way to pass CFLAGS when
invoking rake, that way, at least one can give correct value.

Another way would be to include <ruby.h> first before any others, is
there an issue for doing that?

Cheers,
Henry

2010/1/30 slowhog <henryjen@ztune.net>:
> Hi,
>
> I am trying to install ffi gem on OpenSolaris b130, but encounter
> "_FILE_OFFSET_BITS" redefined error. Below is the result from `rake --
> trace gem:install`.
>
> The error is obvious, but I am not sure what's the right fix. Am I
> missing something?
>
> Cheers,
> Henry
>
> ===> suspicious, not sure if this is expected?
> ** Invoke spec/ffi/rbx/spec_helper.rb (first_time, not_needed)
> ** Invoke spec/ffrake-compiler must be configured first to enable
> cross-compilation
> rake-compiler must be configured first to enable cross-compilation
> rake-compiler must be configured first to enable cross-compilation
> rake-compiler must be configured first to enable cross-compilation
> rm -r pkg
> <...snip...>
> sudo gem install --local pkg/ffi-0.6.0
> Password:
> Building native extensions.  This could take a while...
> ERROR:  Error installing pkg/ffi-0.6.0:
>        ERROR: Failed to build gem native extension.
>
> /usr/ruby/1.8/bin/ruby extconf.rb
> checking for ffi_call() in -lffi... yes
> checking for ffi_prep_closure()... yes
> checking for ffi_raw_call()... no
> checking for rb_thread_blocking_region()... no
> creating extconf.h
> creating Makefile
>
> make
> /usr/sfw/bin/gcc -I. -I. -I/usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11
> -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/usr/sfw/include -fPIC -g -O3 -
> fPIC -I/usr/lib/libffi-3.0.8/include   -Werror -Wunused -Wformat -
> Wimplicit -Wreturn-type   -c Buffer.c
> In file included from /usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11/
> ruby.h:24,
>                 from Buffer.c:31:
> /usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11/config.h:27:1:
> "_FILE_OFFSET_BITS" redefined
> In file included from /usr/include/sys/int_types.h:55,
>                 from /usr/include/sys/stdint.h:38,
>                 from /usr/include/stdint.h:38,
>                 from Buffer.c:29:
> /usr/include/sys/feature_tests.h:209:1: this is the location of the
> previous definition
> make: *** [Buffer.o] Error 1
>
>
> Gem files will remain installed in /var/ruby/1.8/gem_home/gems/
> ffi-0.6.0 for inspection.
> Results logged to /var/ruby/1.8/gem_home/gems/ffi-0.6.0/ext/ffi_c/
> gem_make.out
> rake aborted!
> Command failed with status (1): [sudo gem install --local pkg/
> ffi-0.6.0...]
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
> /home/henryjen/git/ffi/tasks/gem.rake:171
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:636:in `call'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:631:in `each'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:597:in
> `invoke_with_call_chain'
> /usr/ruby/1.8/lib/ruby/1.8/monitor.rb:242:in `synchronize'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:590:in
> `invoke_with_call_chain'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2051:in
> `invoke_task'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2068:in
> `standard_exception_handling'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:2068:in
> `standard_exception_handling'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
> /var/ruby/1.8/gem_home/gems/rake-0.8.7/bin/rake:31
> /usr/bin/rake:19:in `load'
> /usr/bin/rake:19
>