Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libffi: fix build on Apple Silicon #58092

Merged
merged 1 commit into from
Jul 18, 2020

Conversation

mistydemeo
Copy link
Member

@mistydemeo mistydemeo commented Jul 16, 2020

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

I've confirmed this builds and brew test works as expected. I think the failure was because the missing functions we were seeing are defined in platform-specific ASM, and libffi is improperly detecting the platform.

There's a broader set of patches that will be included in a future version, but those are not ready yet. They've been submitted by Apple here: libffi/libffi#565

@Bo98
Copy link
Member

Bo98 commented Jul 16, 2020

Yes, it stems from config.guess being generally broken across many projects and unable to handle Apple Silicon properly.

Copy link
Contributor

@claui claui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builds and works just fine on Apple Silicon, and produces an arm64 binary as it should.

@claui claui added the 11 Big Sur is specifically affected label Jul 16, 2020
@mistydemeo mistydemeo mentioned this pull request Jul 17, 2020
5 tasks
@mistydemeo
Copy link
Member Author

mistydemeo commented Jul 18, 2020

As you might expect for something with this many formulae depending on it, the test failures are unrelated.

@mistydemeo mistydemeo merged commit e2165ba into Homebrew:master Jul 18, 2020
@mistydemeo mistydemeo deleted the libffi_fix_apple_silicon branch July 18, 2020 17:59
@sjackman
Copy link
Member

Yes, it stems from config.guess being generally broken across many projects and unable to handle Apple Silicon properly.

That issue has affected Debian for a long time, building for ARM and other architectures. brew can replace config.guess with our own up-to-date copy whenever we see it, not per formulae, but everywhere.

@Bo98
Copy link
Member

Bo98 commented Jul 30, 2020

I think we should consider doing that. I presume it is safe enough to replace any config.guess/config.sub which exists in the buildpath (recursively?).

@sjackman
Copy link
Member

I think we should consider doing that. I presume it is safe enough to replace any config.guess/config.sub which exists in the buildpath (recursively?).

Yes. Assuming of course that it's a config.guess from Autotools, and not patched in some weird way, which would be very strange.

@OKNoah
Copy link

OKNoah commented Jan 2, 2021

So how can I get ffi to use this libffi installed via home-brew? I think I tried something like --use-system-libffi and I have this in .zshrc

export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"

@OKNoah
Copy link

OKNoah commented Jan 2, 2021

Tried this also:

sudo gem install ffi -- --with-system-libffi PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" CPPFLAGS="-I/opt/homebrew/opt/libffi/include" LDFLAGS="-L/opt/homebrew/opt/libffi/lib"

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 2, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
11 Big Sur is specifically affected outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants