Can't install specific ffi version. If I run gem install ffi, everything works just fine but I need specific version 1.9.18 and it doesn't work.
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-
1.9.18/ext/ffi_c
/Users/chille/.rbenv/versions/2.6.5/bin/ruby -I
/Users/chille/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r
./siteconf20200928-22154-72wopi.rb 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 shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile
current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-
1.9.18/ext/ffi_c
make "DESTDIR=" clean
current directory: /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-
1.9.18/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:355:5: error: implicit declaration of function 'rb_thread_call_without_gvl' is
invalid in C99
[-Werror,-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
^
1 error generated.
make: *** [Call.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.9.18 for inspection.
Results logged to /Users/chille/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-
darwin-19/2.6.0/ffi-1.9.18/gem_make.out
An error occurred while installing ffi (1.9.18), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.18' succeeds before bundling.
In Gemfile:
bootstrap-sass was resolved to 3.3.7, which depends on
sass was resolved to 3.5.5, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
To get past that error, install ffi using:
gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"
if you want bundle install ffi 1.9.8
bundle config --local build.ffi --with-cflags=-Wno-error=implicit-function-declaration
bundle install
For those who can, I think bumping ffi version should be preferred here. bundle update ffi took me from from 1.9.18 to 1.13.1 and built successfully for me.
#denis-osmerovic, unless you have another dependency holding ffi back, you should also be able to bump ffi. Checking my dependency chain, my ffi dependency is also coming from rb-inotify 0.9.10, same as yours. The listed requirement is for ffi (>= 0.5.0, < 2), so 1.13.1 should be acceptable.
Other background:
I previously had a working copy of ffi 1.19.18, and I don't remember needing to pass any special build flags. In order to reproduce this I uninstalled and tried to reinstall that version. I'm guessing other library or toolchain updates in the meantime broke this.
I am running ruby 2.6.3 on OS X 10.15.7 alongside Xcode 12.0.1
On an M1 Catalina 11.6, I was able to get past the error by first doing:
bundle update ffi
Then because I did not care about which version:
gem install ffi -- --with-cflags="-Wno-error=implicit-function-declaration"
If you need a version, other answers have that.
Due to the very nature of what the ffi gem does, it is tightly bound to the internals of the YARV engine. Therefore, you need to make sure you use a version of YARV that matches the version of the ffi gem.
In 2017, that would have been Ruby 2.4. Note that as of April 2020, Ruby 2.4 is no longer supported.
Related
HW: Mac Intel silicon
OS: MacOS Ventura - Version 13.1
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin21]
rails 7.0.2.2
After I installed the MacOS Ventura update, I was getting an error as I was trying to do 'bundle install', and got some errors.
I googled some, and then did the following:
xcode-select --install
When that was finished, I also made sure sure developer tools access to Terminal (through the settings UI).
I ran bundle install again, same results:
Installing racc 1.6.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/my-mac/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/racc-1.6.1/ext/racc/cparse
/Users/my-mac/.asdf/installs/ruby/3.1.0/bin/ruby -I /Users/my-mac/.asdf/installs/ruby/3.1.0/lib/ruby/3.1.0 -r ./siteconf20230126-46139-whcmb7.rb extconf.rb
checking for rb_block_call()... yes
checking for rb_ary_subseq()... yes
creating Makefile
current directory: /Users/my-mac/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/racc-1.6.1/ext/racc/cparse
make DESTDIR\= clean
current directory: /Users/my-mac/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/racc-1.6.1/ext/racc/cparse
make DESTDIR\=
compiling cparse.c
linking shared-object racc/cparse.bundle
ld: warning: -undefined dynamic_lookup may not work with chained fixups
current directory: /Users/my-mac/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/racc-1.6.1/ext/racc/cparse
make DESTDIR\= install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.-.racc.time] Error 1
make install failed, exit code 2
....
An error occurred while installing racc (1.6.1), and Bundler cannot continue.
In Gemfile:
rails was resolved to 7.0.2.2, which depends on
actioncable was resolved to 7.0.2.2, which depends on
actionpack was resolved to 7.0.2.2, which depends on
actionview was resolved to 7.0.2.2, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri was resolved to 1.13.10, which depends on
racc
bundle install used to work fine. I also checked and I do not have a
/usr/local/bin/gmkdir
or
/opt/local/bin/gmkdir
Any ideas?
That compile process is looking for a gnu version of mkdir with the name ‘gmkdir’. This is an attempt to make the process work on windows.
Since the macOS version of mkdir is probably adequate, you can just create an alias to mkdir called ‘gmkdir’ in /user/local/bin’.
This is a hack until that gem install process is updated to realise that it’s on macOS and doesn’t try to build based on defaults for an unknown OS.
I tried all the suggestions, but none worked. The solution was:
brew link --overwrite coreutils
I'm having troubles to do bundle install in one project I get to work on in Rails 4.2.10. When I bundle I receive the next error:
An error occurred while installing ffi (1.9.25), and Bundler cannot continue.
Make sure that gem install ffi -v '1.9.25' succeeds before bundling.
In Gemfile:
s3_direct_upload was resolved to 0.1.6, which depends on
sass-rails was resolved to 5.0.7, which depends on
sass was resolved to 3.6.0, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
When I run gem install ffi -v '1.9.25' also an error occurs:
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
/xxx/xxx/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20190110-6923-1jimorr.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_closure_alloc()... no
checking for ffi_raw_call()... no
checking for shlwapi.h... no
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR=" clean
current directory: /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c
make "DESTDIR="
Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files
cd "/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18" && /Volumes/Macintosh HD/Applications/Xcode.app/Contents/Developer/usr/bin/make
/bin/sh: /Volumes/Macintosh: No such file or directory
make: *** ["/xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a] Error 127
make failed, exit code 2
Gem files will remain installed in /xxx/xxx/.rvm/gems/ruby-2.5.3/gems/ffi-1.9.25 for inspection.
Results logged to /xxx/xxx/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-18/2.5.0/ffi-1.9.25/gem_make.out
I've been trying many solutions online but cannot resolve this issue.
Seems the issue is with my system as I'm new to the team and the other developers were unable to help me as they do not have this kind of issue.
I was able to successfully install ffi with the following command:
LDFLAGS="-L/usr/local/opt/libffi/lib" PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" gem install ffi -v '1.9.25'
Found on some japanese board
According to the libffi README, only GCC is a tested compiler on macOS. You are using Clang, which doesn't support the command line option -print-multi-os-directory.
You need to either patch libffi to work with Clang, or use GCC.
Your error is the following Configuring libffi
clang: error: unsupported option '-print-multi-os-directory'
clang: error: no input files because Clang (wich is the C compiler you are using) doesn't support the option '-print-multi-os-directory'.
Could you check that X-Code command line tools are perfectly installed by executing the following command? xcode-select --install
Also would you mind to try brew install automake autoconf libtool libffi to install required dependencies?
ffi gem 1.9.21 installed successfully.
I also tried to run these commands but no success.
sudo apt install libffi-dev
gem inst ffi
This error occurs when I deploy to AWS. The error looks like this.
Installing dotenv 2.2.1
Installing request_store 1.3.2
Installing draper 3.0.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/opt/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20180207-2245-1bjhja4.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
Running autoreconf for libffi
/var/app/ondeck/vendor/bundle/gems/ffi-1.9.21/ext/ffi_c/libffi/autogen.sh: line 2: exec: autoreconf: not found
make: *** ["/var/app/ondeck/vendor/bundle/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux"/.libs/libffi_convenience.a] Error 127
make failed, exit code 2
Gem files will remain installed in /var/app/ondeck/vendor/bundle/gems/ffi-1.9.21 for inspection.
Results logged to /var/app/ondeck/vendor/bundle/extensions/x86_64-linux/2.2.0-static/ffi-1.9.21/gem_make.out
An error occurred while installing ffi (1.9.21), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.21'` succeeds before bundling. (Executor::NonZeroExitStatus)
Any help will be much appriciated. thanks in advance.
Seems like this issue is due to the ffi latest version, I specified the ffi oldest version in Gemfile gem 'ffi', '1.9.18' run bundle install in the console, it fixed my issue.
As stated in a comment on a relevant issue, the workaround is:
sudo apt install libffi-dev
Do this in your server
sudo apt-get install ruby-dev
Ref: Registered issue
Please let me know If this not worked.
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable 2.3.6
Using chunky_png 1.3.1
Using fssm 0.2.10
Using sass 3.2.19
Using compass 0.12.7
Using breakpoint 2.0.7
Using timers 1.1.0
Using celluloid 0.15.2
Using coderay 1.1.0
Using compass-blend-modes 0.0.2
Using color-schemer 0.2.8
Using compass-normalize 1.5
Using compass-rgbapng 0.2.1
Using compass-validator 3.0.1
Using css_parser 1.3.5
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/Zach/.rvm/rubies/ruby-1.9.3-p547/bin/ruby.exe extconf.rb
checking for main() in -lssl... yes
checking for main() in -lcrypto... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... yes
checking for rb_time_new()... yes
checking for sys/event.h... no
creating Makefile
make clean
make
compiling binder.cpp
make: g++: Command not found
Makefile:198: recipe for target 'binder.o' failed
make: *** [binder.o] Error 127
make failed, exit code 2
Gem files will remain installed in /home/Zach/.rvm/gems/ruby-1.9.3-p547/gems/eventmachine-1.0.3 for inspection.
Results logged to /home/Zach/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-cygwin/1.9.1/eventmachine-1.0.3/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.
I'm trying to install the missing gems necesary so I can use drush omega-guard
There was a problem with your setup: [error]
Resolving dependencies...
Bundler can't satisfy your Gemfile's dependencies.
Install missing gems with `bundle install`.
But I get the error with eventmachine, how can I fix this? I tried changing the version of ruby to see if it works, but i just ran into some other errors.
Apparently you don't have a C++ compiler. If you're using Ubuntu try sudo apt-get install g++.
Trying to run ruby on rails framework under nginx+thin, currently working under WEBrick.
I don't have root access, cause it is hosted at web hosting service.
Till this moment all problems with gems solved w/o root access.
thin requires eventmachine, so:
$ gem install eventmachine
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby18 extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... yes
checking for rb_thread_blocking_region()... no
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile
make
<cutted non-informative output>
make install
/usr/bin/install -c -o root -g wheel -m 0755 rubyeventmachine.so /www/<hostname>/.gems/gems/eventmachine-0.12.10/lib
install: /www/<hostname>/.gems/gems/eventmachine-0.12.10/lib/rubyeventmachine.so: chown/chgrp: Operation not permitted
*** Error code 71
Stop in /www/<hostname>/.gems/gems/eventmachine-0.12.10/ext.
Gem files will remain installed in /www/<hostname>/.gems/gems/eventmachine-0.12.10 for inspection.
Results logged to /www/<hostname>/.gems/gems/eventmachine-0.12.10/ext/gem_make.out
Versions of ruby and installed gems:
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-freebsd8]
$ gem list
activesupport (3.0.9)
backports (2.2.1)
bin (0.6.3)
bson (1.3.1)
i18n (0.4.2)
mongo (1.0.9)
rack (1.1.1)
rake (0.8.7)
rake-compiler (0.7.9)
ruby-augeas (0.3.0)
rubygems-update (1.8.5)
sources (0.0.2)
specific_install (0.2.3)
yard (0.7.2)
I didn't really figured out, is the problem in ERROR: Failed to build gem native extension. or in make install ***Error code 71.
Same thing happens trying $ gem install thin
The error is ERROR: Failed to build gem native extension.. Usually it means something is missing in your system. Ruby development libraries or a dependency of the gem. In this particular case i think libevent (its a dependency of eventmachine) is not in your system.
You will find a complete description of what went wrong at:
/www/<hostname>/.gems/gems/eventmachine-0.12.10/ext/gem_make.out
Thanks for advice, Pablo!
Unfortunately, gem_make.out contained only information I provided, nothing else...
Due to rubyforge bugtracker aboud freebsd, I realised that adding this line to .bashrc solves the problem
export RB_USER_INSTALL="$USER"
After source .bashrc I successfully installed both eventmachine and thin.