From c6c85f84db3bd7bd2d1c5823020c7df007f1bb69 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Sat, 24 Jun 2023 08:13:43 +0200 Subject: [PATCH] macOS `ar` doesn't support `@` syntax (#22146) When the linker command line is long, Nim compiler generates a file for passing the linker arguments. On `macOS`, that mechanism fails as the `@` syntax is not supported by `ar`. Use `xargs` instead to pass the linker arguments file. --- compiler/extccomp.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 040fe35e19..832242456a 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -834,7 +834,10 @@ proc linkViaResponseFile(conf: ConfigRef; cmd: string) = else: writeFile(linkerArgs, args) try: - execLinkCmd(conf, cmd.substr(0, last) & " @" & linkerArgs) + when defined(macosx): + execLinkCmd(conf, "xargs " & cmd.substr(0, last) & " < " & linkerArgs) + else: + execLinkCmd(conf, cmd.substr(0, last) & " @" & linkerArgs) finally: removeFile(linkerArgs)