From 2c1b851a80146101e376c042f081998f499a0eaf Mon Sep 17 00:00:00 2001 From: Will Date: Wed, 3 Jun 2026 11:06:28 -0500 Subject: [PATCH 1/2] Add Mac OS for lakefile.lean --- lakefile.lean | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lakefile.lean b/lakefile.lean index 313e0b57..f24ee913 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -39,12 +39,12 @@ private def nativeLinkArgs : Array String := "-lstdc++", "-Wl,-rpath," ++ s!"{cudaHome}/lib64" ] - else if Platform.isWindows then + else if Platform.isWindows || Platform.isOSX then + -- Windows and macOS provide libm via the default C runtime #[] else - -- CPU stubs call functions from `math.h`; CUDA objects are C++ when a checkout switches - -- between CPU and CUDA builds without cleaning `.lake`, so Linux links both runtimes. - #["-lm", "-lstdc++"] + -- CPU stubs call functions from `math.h`; Linux keeps these in `libm` + #["-lm"] package TorchLean where version := v!"0.1.0" From 21f020f953bdb684c19968ed9d3659dfdde9e0a3 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 3 Jun 2026 10:15:08 -0700 Subject: [PATCH 2/2] Fix macOS native link flags --- lakefile.lean | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lakefile.lean b/lakefile.lean index f24ee913..34b73821 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -43,8 +43,9 @@ private def nativeLinkArgs : Array String := -- Windows and macOS provide libm via the default C runtime #[] else - -- CPU stubs call functions from `math.h`; Linux keeps these in `libm` - #["-lm"] + -- CPU stubs call functions from `math.h`; Linux keeps these in `libm`. + -- Keep libstdc++ for mixed native objects when switching between CPU and CUDA builds. + #["-lm", "-lstdc++"] package TorchLean where version := v!"0.1.0"