A macOS static linking mystery

Ryan Scott ryan.gl.scott at gmail.com
Mon Aug 8 23:33:13 UTC 2022


I should clarify that I'm using a borrowed macOS on which I don't have
admin privileges, so I'm unable to install pkg-config. As a result, I'm
commenting out the pkgconfig-depends: line in libffi.cabal and manually
specifying the extra-lib-dirs and include-dirs via a cabal.project.local
file.

I've configured the project to use both the macOS system libffi (located at
/usr/lib/libffi.dylib) as well as the version that Homebrew provides. Both
configurations exhibit the strange, apparently-statically-linked behavior.
Even stranger, the macOS system libffi _only_ provides a .dylib file, not
an .a file. If I examine the x86 code of the compiled executable using
`objdump -d`, I can see various libffi definitions (e.g., _ffi_call), so
perhaps these definitions are being inlined through some kind of link-time
optimization? I'm really not sure how else to explain what's happening.

Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20220808/9ea03c00/attachment.html>


More information about the ghc-devs mailing list