Repository navigation
Conversation
Remove the explicit -lLake overrides from mk_all and lint-style. The toolchain already supplies Lake and its dependencies for the selected linkage model. The override can mix static and shared Lake on Windows, registering environment extensions twice when loading a workspace. Validated on Windows with Lean 4.36.0-rc1: a fresh build of both executables, mk_all --check, lint-style, and git diff --check. Linux/macOS linkage was checked in the pinned toolchain source, not executed locally. AI assistance: Codex investigated the regression, ran reproductions, and prepared the patch and PR description.
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to Zulip and join the Lean community. |
PR summary 2f0dccbd5cImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
Thanks! |
Remove the explicit `-lLake` overrides from `mk_all` and `lint-style`. On Windows, I found both executables to otherwise fail when loading a Lake workspace, with message: ```text error: invalid environment extension, 'Lake.packageAttr' has already been used uncaught exception: failed to load Lake workspace ``` The Lean toolchain specified in Mathlib’s `lean-toolchain` file already supplies `-lLake -lLeanExport` for static linking and `-lLake_shared` for shared linking ([source](https://github.com/leanprover/lean4/blob/c9afcddf514a6772bd4d649f7cfc04eff0b9f15e/src/CMakeLists.txt#L508-L514)). Removing the overrides lets Lake select the matching static or shared libraries. The regression came from [Lean #14885](leanprover/lean4#14885), which added a `LeanExport` dependency to Lake. With the explicit static `-lLake`, unresolved `LeanExport` initializers are taken from `libLake_shared.dll`, loading a second copy of Lake and duplicating initialization. Previously the unused DLL was omitted. [Lean #14963](leanprover/lean4#14963) added `-lLeanExport` to the automatic static flags, but Windows interpreter executables use the shared flags, so Mathlib's explicit override still causes this mixture. The old overrides originated in [Mathlib #13850](#13850).
|
Pull request successfully merged into master. Build succeeded: |
Remove the explicit
-lLakeoverrides frommk_allandlint-style. On Windows, I found both executables to otherwise fail when loading a Lake workspace, with message:The Lean toolchain specified in Mathlib’s
lean-toolchainfile already supplies-lLake -lLeanExportfor static linking and-lLake_sharedfor shared linking (source). Removing the overrides lets Lake select the matching static or shared libraries.The regression came from Lean #14885, which added a
LeanExportdependency to Lake. With the explicit static-lLake, unresolvedLeanExportinitializers are taken fromlibLake_shared.dll, loading a second copy of Lake and duplicating initialization. Previously the unused DLL was omitted. Lean #14963 added-lLeanExportto the automatic static flags, but Windows interpreter executables use the shared flags, so Mathlib's explicit override still causes this mixture. The old overrides originated in Mathlib #13850.Validation on Windows with Lean 4.36.0-rc1:
lake --no-cache build mk_all lint-stylelake exe mk_all --checklake exe lint-stylegit diff --checkA standalone reproducer also passes on the August 27, 2026 nightly and produces the exact error on the August 28 nightly. Removing
-lLakefixes both that nightly and toolchains 4.35.0 and 4.36.0-rc1. Adding static-lLeanExportalso removes the DLL dependency and fixes the reproducer, confirming the dependency mechanism. Linux/macOS flag selection was checked in the toolchain source, not run locally.AI assistance: Codex investigated the regression, ran the reproductions, prepared the patch, and drafted this description.
As a side note, perhaps we should consider adding Windows CI to prevent such regression in the future. Let me know if you'd like a PR.