
On Mon, Aug 08, 2022 at 07:29:38AM -0400, Ryan Scott wrote:
An exception to this rule is macOS, however. On macOS, building libffi always appears to default to linking against the static version of libffi, even when a dynamic version is also available. To reproduce this phenomenon, check out libffi [1] and run the following commands:
$ brew install libffi # If it is not already installed $ cabal build ctime $ otool -L $(cabal list-bin ctime)
What is the output of $ pkg-config --libs libffi on this system? If "cabal" passes any additional flags to "pkg-config" use those as well. On my MacOS laptop I get: $ /usr/local/bin/pkg-config --libs libffi -lffi which does not use the "brew"-installed libffi. Not surprising, since /usr/local/lib/pkgconfig/ has no symlink to the "libffi.pc" file.
This is exceedingly strange, since my Hombrew installation does in fact provide libffi.dylib:
$ ls -alh ~/Software/homebrew/Cellar/libffi/3.4.2/lib/ [...] drwxr-xr-x 3 rscott 1340850540 96B Aug 7 08:51 pkgconfig
For "pkg-config" to find the HomeBrew "libffi", there would need to be a "libffi.pc" symlink to the one in the "pkgconfig" directory. Perhaps there are additional steps to perform in HomeBrew to activate this "libffi" as a default target for "pkg-config". -- Viktor.