On FreeBSD we always have the /usr/bin/ar executable which is a llvm-ar in disguise.
On my system I also have /usr/local/bin/ar executable that comes from the GNU binutils package. My PATH is set up in such a way that the base ar is preferred:
However, running stack --system-ghc build on my project results in
base-compat > [ 57 of 130] Compiling Data.Ratio.Compat
bsb-http-chunked > /usr/local/bin/ar: invalid option -- L
bsb-http-chunked > Usage: /usr/local/bin/ar [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
The problem here is that GHC calls ar believing it supports the -L flag, which is true for /usr/bin/ar. But somehow the GNU version gets invoked instead.
Now, in /usr/local/lib/ghc-9.10.3/lib/settings I have
,("ar command", "ar")
,("ar flags", "qcls")
,("ar supports at file", "YES")
,("ar supports -L", "YES")
If I change it to ("ar command", "/usr/bin/ar") the problem goes away.
Stack version
stack --version
Version 3.9.1 x86_64
On FreeBSD we always have the
/usr/bin/arexecutable which is allvm-arin disguise.On my system I also have
/usr/local/bin/arexecutable that comes from the GNUbinutilspackage. MyPATHis set up in such a way that the basearis preferred:However, running
stack --system-ghc buildon my project results inThe problem here is that GHC calls
arbelieving it supports the-Lflag, which is true for/usr/bin/ar. But somehow the GNU version gets invoked instead.Now, in
/usr/local/lib/ghc-9.10.3/lib/settingsI haveIf I change it to
("ar command", "/usr/bin/ar")the problem goes away.Stack version