Subject: [ruby-ffi] Re: Arch build error due to ruby trunk compile options |
From: Wayne Meissner |
Date: 8/22/12 5:44 AM |
To: ruby-ffi@googlegroups.com |
With ruby trunk the last few ffi gem releases have failed to build on my Arch 3.4.7 32bit dev system with gcc 4.7.1 (20120721).
Given the details and workaround info below, the root cause appears to be recent `configure.in` ansi compliance mods:
https://github.com/ruby/ruby/blob/trunk/configure.in#L619- 635
Looks like others are running into as well
https://github.com/flori/json/issues/142
While I've only briefly investigated, I don't have time to fully look into it. But I don't want to forget about it.
*** GEM UPDATE FAILURE ***
[jon@archee ~]$ gem update ffi --user-install
Updating installed gems
Updating ffi
Fetching: ffi-1.1.5.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for rb_thread_blocking_region()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile
make
compiling Pointer.c
In file included from Pointer.c:34:0:
rbffi_endian.h:46:4: error: #error "Cannot determine the endian-ness of this platform"
Pointer.c: In function 'ptr_order':
Pointer.c:339:59: error: 'BYTE_ORDER' undeclared (first use in this function)
Pointer.c:339:59: note: each undeclared identifier is reported only once for each function it appears in
Pointer.c:339:72: error: 'BIG_ENDIAN' undeclared (first use in this function)
Pointer.c:351:25: error: 'LITTLE_ENDIAN' undeclared (first use in this function)
Pointer.c:368:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [Pointer.o] Error 1
Gem files will remain installed in /home/jon/.gem/ruby/2.0.0/gems/ffi-1.1.5 for inspection.
Results logged to /home/jon/.gem/ruby/2.0.0/gems/ffi-1.1.5/ext/ffi_c/gem_ make.out
Nothing to update
*** WORKAROUND ***
gem update ffi --user-install -- --with-cflags='--std=gnu99'
*** SYSTEM INFO ***
# rbconfig.rb contents:
CONFIG["warnflags"] = "-Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after- statement -Werror=implicit-function- declaration -ansi -std=iso9899:199409"
CONFIG["WERRORFLAG"] = "-Werror"
[jon@archee ~]$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 2.0.0 (2012-08-10 patchlevel -1) [i686-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.0.0
- /home/jon/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org"]
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org
Jon
---
Fail fast. Fail often. Fail publicly. Learn. Adapt. Repeat.
http://thecodeshop.github.com | http://jonforums.github.com/
twitter: @jonforums