When building a shared library and linking a dependency of that shared library statically via moreLinkObjs = ["pkg/tgt:static"] (as in #lean4 > Load plugin during build? ), sometimes I see a
⚠ [710/765] Built Batteries.Data.Char.Basic:c.o
warning: /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/batteries/.lake/build/ir/Batteries/Data/Char/Basic.c.o.export.trace: offset 0: unexpected end of input
and this seems to break things when using the shared library as a plugin later (by emitting a similar "offset 0" error). But sometimes, it builds without issue.
However, I tried minimizing, and have been unsuccessful. :( This only seems to happen on the branch I'm using for experimenting with making Mathlib.Init a plugin, which you can find at #33015 (draft PR created only for convenient sharing).
(Note for the concerned reader: I have zero plans to actually make Mathlib.Init a plugin—it's just a really useful test case for exploring plugins due to its complexity and convenient "separation" from Mathlib! :) )
To be clear, what I'm running here is lake build MathlibInit. You can see a log demonstrating the nondeterminism here (the second lake build MathlibInit is successful, but the third has different errors!)
thomas@trm mathlib4 % rm -rf ./.lake
thomas@trm mathlib4 % lake build MathlibInit
info: plausible: cloning https://github.com/leanprover-community/plausible
info: plausible: checking out revision '8d3713f36dda48467eb61f8c1c4db89c49a6251a'
info: LeanSearchClient: cloning https://github.com/leanprover-community/LeanSearchClient
info: LeanSearchClient: checking out revision '19e5f5cc9c21199be466ef99489e3acab370f079'
info: importGraph: cloning https://github.com/leanprover-community/import-graph
info: importGraph: checking out revision '4eb26e1a4806b200ddfe5179d0c2a0fae56c54a7'
info: proofwidgets: cloning https://github.com/leanprover-community/ProofWidgets4
info: proofwidgets: checking out revision 'ef8377f31b5535430b6753a974d685b0019d0681'
info: aesop: cloning https://github.com/leanprover-community/aesop
info: aesop: checking out revision 'fb12f5535c80e40119286d9575c9393562252d21'
info: Qq: cloning https://github.com/leanprover-community/quote4
info: Qq: checking out revision '523ec6fc8062d2f470fdc8de6f822fe89552b5e6'
info: batteries: cloning https://github.com/leanprover-community/batteries
info: batteries: checking out revision '6254bed25866358ce4f841fa5a13b77de04ffbc8'
info: Cli: cloning https://github.com/leanprover/lean4-cli
info: Cli: checking out revision '726b98c53e2da249c1de768fbbbb5e67bc9cef60'
⚠ [ 710 /765] Built Batteries.Data.Char.Basic:c.o
warning: /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/batteries/.lake/build/ir/Batteries/Data/Char/Basic.c.o.export.trace: offset 0 : unexpected end of input
Build completed successfully ( 765 jobs ) .
thomas@trm mathlib4 % rm -rf ./.lake
thomas@trm mathlib4 % lake build MathlibInit
info: plausible: cloning https://github.com/leanprover-community/plausible
info: plausible: checking out revision '8d3713f36dda48467eb61f8c1c4db89c49a6251a'
info: LeanSearchClient: cloning https://github.com/leanprover-community/LeanSearchClient
info: LeanSearchClient: checking out revision '19e5f5cc9c21199be466ef99489e3acab370f079'
info: importGraph: cloning https://github.com/leanprover-community/import-graph
info: importGraph: checking out revision '4eb26e1a4806b200ddfe5179d0c2a0fae56c54a7'
info: proofwidgets: cloning https://github.com/leanprover-community/ProofWidgets4
info: proofwidgets: checking out revision 'ef8377f31b5535430b6753a974d685b0019d0681'
info: aesop: cloning https://github.com/leanprover-community/aesop
info: aesop: checking out revision 'fb12f5535c80e40119286d9575c9393562252d21'
info: Qq: cloning https://github.com/leanprover-community/quote4
info: Qq: checking out revision '523ec6fc8062d2f470fdc8de6f822fe89552b5e6'
info: batteries: cloning https://github.com/leanprover-community/batteries
info: batteries: checking out revision '6254bed25866358ce4f841fa5a13b77de04ffbc8'
info: Cli: cloning https://github.com/leanprover/lean4-cli
info: Cli: checking out revision '726b98c53e2da249c1de768fbbbb5e67bc9cef60'
Build completed successfully ( 768 jobs ) .
thomas@trm mathlib4 % rm -rf ./.lake
thomas@trm mathlib4 % lake build MathlibInit
info: plausible: cloning https://github.com/leanprover-community/plausible
info: plausible: checking out revision '8d3713f36dda48467eb61f8c1c4db89c49a6251a'
info: LeanSearchClient: cloning https://github.com/leanprover-community/LeanSearchClient
info: LeanSearchClient: checking out revision '19e5f5cc9c21199be466ef99489e3acab370f079'
info: importGraph: cloning https://github.com/leanprover-community/import-graph
info: importGraph: checking out revision '4eb26e1a4806b200ddfe5179d0c2a0fae56c54a7'
info: proofwidgets: cloning https://github.com/leanprover-community/ProofWidgets4
info: proofwidgets: checking out revision 'ef8377f31b5535430b6753a974d685b0019d0681'
info: aesop: cloning https://github.com/leanprover-community/aesop
info: aesop: checking out revision 'fb12f5535c80e40119286d9575c9393562252d21'
info: Qq: cloning https://github.com/leanprover-community/quote4
info: Qq: checking out revision '523ec6fc8062d2f470fdc8de6f822fe89552b5e6'
info: batteries: cloning https://github.com/leanprover-community/batteries
info: batteries: checking out revision '6254bed25866358ce4f841fa5a13b77de04ffbc8'
info: Cli: cloning https://github.com/leanprover/lean4-cli
info: Cli: checking out revision '726b98c53e2da249c1de768fbbbb5e67bc9cef60'
⚠ [ 510 /767] Built Batteries.Control.Monad:c.o
warning: /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/batteries/.lake/build/ir/Batteries/Control/Monad.c.o.export.trace: offset 0 : unexpected end of input
⚠ [ 623 /767] Built Batteries.Data.Vector:c.o
warning: /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/batteries/.lake/build/ir/Batteries/Data/Vector.c.o.export.trace: offset 0 : unexpected end of input
Build completed successfully ( 767 jobs ) .
And for reference, here's an example of the similar error I see upon lake build Mathlib sometimes:
✖ [ 16 /653] Building MathlibInit.Linter.Header
trace: .> LEAN_PATH = /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/Cli/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/batteries/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/Qq/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/aesop/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/proofwidgets/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/importGraph/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/LeanSearchClient/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/packages/plausible/.lake/build/lib/lean:/Users/thomas/LeanContribution/thorimur/mathlib4/.lake/build/lib/lean /Users/thomas/.elan/toolchains/leanprover--lean4---v4.27.0-rc1/bin/lean /Users/thomas/LeanContribution/thorimur/mathlib4/MathlibInit/Linter/Header.lean -o /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/build/lib/lean/MathlibInit/Linter/Header.olean -i /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/build/lib/lean/MathlibInit/Linter/Header.ilean -c /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/build/ir/MathlibInit/Linter/Header.c --setup /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/build/ir/MathlibInit/Linter/Header.setup.json --json
info: stderr:
failed to load header from /Users/thomas/LeanContribution/thorimur/mathlib4/.lake/build/ir/MathlibInit/Linter/Header.setup.json: offset 0 : unexpected end of input
error: Lean exited with code 1
(This occurs for many different files referencing files in MathlibInit.)
Last updated: Dec 20 2025 at 21:32 UTC