Thanks to David Rodriguez (our dear bundler upstream maintainer :) I was able to workaround the bug locally and understand a bit better what is going on.

The source of this problem is this commit:

https://github.com/rubygems/rubygems/commit/226ec115fe503bcc93bffdf5cd3e8a668890b4d8

Quoting David:

"Anyways, the actual check making bundler believe the ffi gem is missing extensions is `File.exist?(gem_build_complete_path)`. I believe the idea of this check is that bundler/rubygems are not able to know which artifacts an extension will generate, so what rubygems does is generating this dummy file at a well known path after a successful extension compilation, so that it can later check the existence of this path when it needs to know whether a gem is missing extensions."

There are 2 workarounds to fix this issue:

1) Create this dummy file.

$ mkdir -p /usr/share/rubygems-integration/2.7.0/extensions/x86_64-linux/2.7.0/ffi-1.12.2/ $ touch /usr/share/rubygems-integration/2.7.0/extensions/x86_64-linux/2.7.0/ffi-1.12.2/gem.build_complete

After that 'bundle --local' will find the ffi gem.

2) Remove the extension from gemspec.

$ sed -i.bak -e 3d /usr/share/rubygems-integration/2.7.0/specifications/ffi-1.12.2.gemspec

After removing the header line containing "# stub: ext/ffi_c/extconf.rb", 'bundler --local' also works fine and find the ffi gem.

I think the second approach is what we want, and the proper fix would be to not include extensions in our gemspecs. We could try to achieve that via gem2deb. Any thoughts?

--
Lucas Kanashiro

Reply via email to