Following this post I encountered an issue while running bundle update --bundler
. The process failed due to an error with the ffi gem installation.
Fetching gem metadata from https://rubygems.org/.Fetching gem metadata from https://rubygems.org/............Resolving dependencies...Resolving dependencies...Fetching ffi 1.9.25Fetching json 2.6.3Fetching rb-fsevent 0.10.3Fetching parallel 1.12.1Fetching ruby-progressbar 1.10.0Installing parallel 1.12.1Installing rb-fsevent 0.10.3Installing json 2.6.3 with native extensionsInstalling ffi 1.9.25 with native extensionsInstalling ruby-progressbar 1.10.0Gem::Ext::BuildError: ERROR: Failed to build gem native extension.current directory:C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/ffi-1.9.25/ext/ffi_cC:/tools/ruby33/bin/ruby.exe extconf.rbchecking for pkg-config for libffi... not foundchecking for ffi.h... *** extconf.rb failed ***Could not create Makefile due to some reason, probably lack of necessarylibraries and/or headers. Check the mkmf.log file for more details. You mayneed configuration options.Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include=${opt-dir}/include --without-opt-include --with-opt-lib=${opt-dir}/lib --without-opt-lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/tools/ruby33/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include=${ffi_c-dir}/include --without-ffi_c-include --with-ffi_c-lib=${ffi_c-dir}/lib --without-ffi_c-lib --with-libffi-dir --without-libffi-dir --with-libffi-include=${libffi-dir}/include --without-libffi-include --with-libffi-lib=${libffi-dir}/lib --without-libffi-lib --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config --with-ffi-dir --without-ffi-dir --with-ffi-include=${ffi-dir}/include --without-ffi-include --with-ffi-lib=${ffi-dir}/lib --without-ffi-libC:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:480:in `try_do': The compiler failed togenerate an executable file. (RuntimeError)You have to install development tools first. from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:606:in `block in try_compile' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:555:in `with_werror' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:606:in `try_compile' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:1151:in `block in have_header' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:983:in `block in checking_for'from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:344:in `block (2 levels) inpostpone' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:314:in `open' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:344:in `block in postpone' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:314:in `open' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:340:in `postpone' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:982:in `checking_for' from C:/tools/ruby33/lib/ruby/3.3.0/mkmf.rb:1150:in `have_header' from extconf.rb:16:in `'To see why this extension failed to compile, please check the mkmf.log which canbe found here:C:/Users/FooBar/.local/share/gem/ruby/3.3.0/extensions/x64-mingw-ucrt/3.3.0/ffi-1.9.25/mkmf.logextconf failed, exit code 1Gem files will remain installed inC:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/ffi-1.9.25 for inspection.Results logged toC:/Users/FooBar/.local/share/gem/ruby/3.3.0/extensions/x64-mingw-ucrt/3.3.0/ffi-1.9.25/gem_make.out C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:28:in`build'C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:193:in`build_extension'C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:227:in `blockin build_extensions' C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/ext/builder.rb:224:in`build_extensions'C:/tools/ruby33/lib/ruby/site_ruby/3.3.0/rubygems/installer.rb:852:in`build_extensions'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/rubygems_gem_installer.rb:76:in`build_extensions'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/rubygems_gem_installer.rb:28:in`install'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/source/rubygems.rb:205:in`install'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/installer/gem_installer.rb:54:in`install'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/installer/gem_installer.rb:16:in`install_from_spec'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/installer/parallel_installer.rb:132:in`do_install'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/installer/parallel_installer.rb:123:in`block in worker_pool'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/worker.rb:62:in`apply_func'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/worker.rb:57:in`block in process_queue' :187:in `loop'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/worker.rb:54:in`process_queue'C:/Users/FooBar/.local/share/gem/ruby/3.3.0/gems/bundler-2.5.5/lib/bundler/worker.rb:90:in`block (2 levels) in create_threads'An error occurred while installing ffi (1.9.25), and Bundler cannot continue.In Gemfile: listen was resolved to 3.8.0, which depends on rb-inotify was resolved to 0.9.10, which depends on ffi
Here are the steps I've taken so far:
- Initially, I tried running
bundle update --bundler
, but it failed due to an ffi installation error. - Suspecting that I might need the Ruby Development Kit (DevKit), I uninstalled my existing Ruby installation. Since the Chocolatey package for DevKit was deprecated, I opted for "Ruby 3.2 with MSYS2 RubyInstallerTeam.RubyWithDevKit.3.2 3.2.2-1 Tag: ruby winget" using winget.
- Next, I installed
mingw-w64-x86_64-libffi
usingucrt64.exe
run as administrator. - After this setup, running
gem install ffi --platform=ruby
worked successfully.
However, I am still facing issues with other dependencies. The ffi
gem installation seems correct but doesn't resolve the overall bundler update failure.
Here's a snippet of the error log.
I am seeking guidance on setting up my environment to resolve these issues properly. Any insights or suggestions on what might be going wrong or what additional steps should be taken would be greatly appreciated.