# Pastebin Nxj0uRaZ having linker issues on macos (following https://gitlab.haskell.org/ghc/ghc/issues/14444, which references both https://github.com/NixOS/nixpkgs/pull/27536 and https://github.com/NixOS/nixpkgs/pull/38881). the people at simspace ported the nix logic to a script here: https://github.com/Simspace/ld-wrapper-macos. Using this, I made some progress, and our library at work now builds, but the executables and test suites do not. Upon investigating, noticed some weird coincidences. setting DEBUG=true in the script and then running `cabal build -v3` reveals that: 1. Script complains that `ld` is being passed an unrecognised flag. This is really unusual. Haven't seen which flag it is yet. 2. Get errors from from `ld` complaining that `-filelist` is being passed a NULL string, or a dash. The ld source confirms this: https://opensource.apple.com/source/ld64/ld64-274.2/src/ld/Options.cpp.auto.html. Looking at the debug output, this is not correct, it is being passed actual files. So, looking at output of: `grep filelist foo.txt | head -n 1 | sed 's/^[+] exec ld //g' | sed 's/filelist.*/filelist/g' | wc -c`, we get `63580`, which is suspiciously close to and just above 2^16. This makes me think that argv to `ld` is being cut off at some point and causing a lot of issues Perhaps shlevy or Ericson2314 might be aware of a solution? Note that at work we use nix-shell+cabal for local development, and on MACOS, `cabal v2-build` fails due to these linker issues. Nix builds work fine (somehow), and I have thought of suggesting just using nix build for running anything locally, but then people lose incremental builds. This is a pretty large project (almost 500 modules in the library, another 150 in the test suite) so that's a bit of a big loss.