diff --git a/src/lake/Lake/Build/Actions.lean b/src/lake/Lake/Build/Actions.lean index 3ac3dc6a99..1d4c8b7b1b 100644 --- a/src/lake/Lake/Build/Actions.lean +++ b/src/lake/Lake/Build/Actions.lean @@ -87,21 +87,20 @@ public def compileO } public def mkArgs (basePath : FilePath) (args : Array String) : LogIO (Array String) := do - if Platform.isWindows then - -- Use response file to avoid potentially exceeding CLI length limits. - let rspFile := basePath.addExtension "rsp" - let h ← IO.FS.Handle.mk rspFile .write - args.forM fun arg => - -- Escape special characters - let arg := arg.foldl (init := "") fun s c => - if c == '\\' || c == '"' then - s.push '\\' |>.push c - else - s.push c - h.putStr s!"\"{arg}\"\n" - return #[s!"@{rspFile}"] - else - return args + -- Use response file to avoid potentially exceeding CLI length limits. + -- On Windows this is always needed; on macOS/Linux this is needed for large + -- projects like Mathlib where the number of object files exceeds ARG_MAX. + let rspFile := basePath.addExtension "rsp" + let h ← IO.FS.Handle.mk rspFile .write + args.forM fun arg => + -- Escape special characters + let arg := arg.foldl (init := "") fun s c => + if c == '\\' || c == '"' then + s.push '\\' |>.push c + else + s.push c + h.putStr s!"\"{arg}\"\n" + return #[s!"@{rspFile}"] public def compileStaticLib (libFile : FilePath) (oFiles : Array FilePath)