Skip to content

Disable use of system libffi for building ffi gem

Stan Hu requested to merge sh-avoid-system-ffi into main

What does this merge request do and why?

The ffi gem will attempt to use the system ffi library if the development headers and libraries are available. Otherwise, the gem will compile and install its own static library. For the GDK, the latter approach is advantageous since the GDK won't break if the system's version is upgraded.

We ran into a similar issue with Omnibus GitLab: omnibus-gitlab!6800 (merged)

Relates to:

  1. #891
  2. #1783 (closed)

How to set up and validate locally

On macOS:

  1. Run otool -L ~/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/ffi-1.15.5//lib/ffi_c.bundle | grep libffi
  2. You should see a line like:
	/usr/lib/libffi.dylib (compatibility version 1.0.0, current version 30.0.0)
  1. Run bundle config build.ffi "--disable-system-libffi".
  2. In gitlab/, run gem uninstall ffi (confirm yes) and then bundle install.
  3. otool -L ~/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/ffi-1.15.5//lib/ffi_c.bundle | grep libffi should now show nothing.

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Stan Hu

Merge request reports

Loading