Draft: Fix building FFI gem on M1
What does this merge request do and why?
Fix building ffi gem on M1
In a previous commit [1], we switched to using the built-in FFI
provided with the ffi
Ruby gem to avoid problems with upgrades
to the system FFI breaking the gem. However, this doesn't always
work because the built-in FFI implementation doesn't always build
correctly, dependent on the system compiler. For example, many
M1 Macs with a recent XCode installation are seeing odd failures
since 2022 [2].
In this commit, the switch to use --disable-system-ffi
is reveted;
however, we still won't be using the system FFI. Instead, we will
take advantage of the fact that we use a Brewfile
and have
Homebrew install a stable libffi
version for us.
[1] !3061 (merged) [2] https://github.com/ffi/ffi/issues/937
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
With an existing GDK setup, the following will simulate the changes:
- Run
gem uninstall ffi
- Run
bundle config unset build.ffi
(to remove the previous config) - Run
brew bundle
(to installlibffi
) - Run
bundle config build.ffi "--with-ld-flags=-L$(brew --prefix libffi)/lib --with-cppflags=-I$(brew --prefix libffi)/include"
With a new GDK setup:
- Clone the repository as usual
- Check out this merge request's branch
- Run the remainder of the bootstrap/install process as usual
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
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 theCHANGELOG.md
.