Skip to content

fix: declare lean_mark_persistent_unshared with LEAN_EXPORT before its use - #12

Merged
legion-implementer[bot] merged 1 commit into
fork/v4.36-lazy-import-names-r21from
legion/LINUX-1736-lazy-import-names
Nov 28, 2026
Merged

legion-implementer[bot] merged 1 commit into
fork/v4.36-lazy-import-names-r21from
legion/LINUX-1736-lazy-import-names

Conversation

@legion-implementer

@legion-implementer legion-implementer Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

This PR fixes the Windows bootstrap build by marking the forward declaration of lean_mark_persistent_unshared for export.

The job "build / Windows" failed at "Build Stage 0 & Configure Stage 1" on the
tag v4.36-machcsl-r20:

stage0/src/runtime/object.cpp:582:29: error: redeclaration of
'lean::lean_mark_persistent_unshared' cannot add 'dllexport' attribute

object.cpp declares the function without LEAN_EXPORT before
mark_persistent_unshared_fn uses it, and defines it with LEAN_EXPORT
below. On Windows LEAN_EXPORT is dllexport, which a redeclaration cannot
add. The forward declaration now carries LEAN_EXPORT, in src/ and in the
stage0 copy that stage 0 builds; on Linux and macOS, where LEAN_EXPORT sets
default visibility, nothing changes.

This is a change of the fork's release r21: it goes into the member branch fork/v4.36-lazy-import-names-r21, which r21 merges in place of the member it copies. It merges as a squash after its review, when r21 is cut.

Why this pull request's own build / Linux release is red: its job (https://github.com/sjawhar/lean4/actions/runs/46107451946/job/140863304584) stops at Upload Lake Cache, before any test: a pull request's run takes its workflow files from the member branch, which carries upstream's .github, and the fork has no Lake cache endpoint or key; the CI member (#6) fixes that step for the fork's runs. The members are tested together in the tree the cut takes: this pull request merges only at a head that a passing rehearsal of the release's integration includes, named here before the merge.

Dispatch: LINUX-1736

…s use

The job "build / Windows" failed at "Build Stage 0 & Configure Stage 1" on the
tag v4.36-machcsl-r20:

    stage0/src/runtime/object.cpp:582:29: error: redeclaration of
    'lean::lean_mark_persistent_unshared' cannot add 'dllexport' attribute

object.cpp declares the function without `LEAN_EXPORT` before
`mark_persistent_unshared_fn` uses it, and defines it with `LEAN_EXPORT`
below. On Windows `LEAN_EXPORT` is `dllexport`, which a redeclaration cannot
add. The forward declaration now carries `LEAN_EXPORT`, in src/ and in the
stage0 copy that stage 0 builds; on Linux and macOS, where `LEAN_EXPORT` sets
default visibility, nothing changes.

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
legion-implementer Bot added a commit that referenced this pull request Nov 28, 2026
…ntegration

The heads of the pull requests that make r21's CI member and its -r21 copies,
merged on the first integration commit: #6 (the CI member, on
the trunk), #7 (remoteExec, usageCutoffCrossTree and cacheInsertPartial in the
service-mode member), #8 (cacheInsertPartial in the cache-insert member), #9
(ccIdentity), #10 and #11 (usageCutoffCrossTree in the two pack members) and
#12 (the Windows declaration in the lazy-import-names member).

The merge needs no resolution: its tree is the first integration commit's
tree with each pull request's change, and where two of them make the same
change (usageCutoffCrossTree's writable lakefile, cacheInsertPartial's
preload) that change once.

Refs: LINUX-1736
Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
@legion-implementer

Copy link
Copy Markdown
Author

Review pass by a reviewer of another model family (openai/gpt-6.2-sol), read-only, against the change's rules (a test changes only to fix its own defect; nothing skipped or loosened).

  • Head f5c9ddada881: approve, no findings.

legion-implementer Bot added a commit that referenced this pull request Nov 28, 2026
… on 64 GB

The decision on the jobs of the fork's tag build other than Linux release
(LINUX-1736, E3(5)), applied in the build matrix of `configure`. "The fork's
tag build" is a fork's tag push or a dispatch with `release_tag`: the runs
in which "Check for custom releases" gives a tag, which the matrix script
now reads as the Boolean `forkTag`. On every other event (pull_request,
merge_group, a push to master, schedule, a nightly, leanprover/lean4's own
tags) the matrix is unchanged.

- macOS aarch64 and Windows: not tested in the fork's tag build; they still
  build there, as a compile check. With `test` false their Test step does
  not run, nor the steps that only read its results (Protect and Unprotect
  Source Tree, Check Source Tree Clean, Embed Test Output, Test Summary,
  Check Test Binary, all conditioned on `matrix.test` or on the Test step's
  conclusion in build-template.yml, which is unchanged). The fork publishes
  no macOS or Windows build. On r20's tag 27 Lake tests and
  elab/openssl.lean failed on macOS aarch64: the fork's Lake tests assume
  GNU tools and a newer bash than macOS's bash 3.2, and the runner's OpenSSL
  is 4. The fork's tests assume a POSIX system, so Windows failed 40 tests in
  a rehearsal of r21's tag build; #12 keeps its build working.
- Linux tsanitize: in theorem-labs/lean4's tag build it runs on the GitHub
  larger runner `ubuntu-24.04-16core` (16 CPUs, 64 GB). On ubuntu-latest the
  runner was lost about 39 s into elab/async_http_h1_incremental.lean, on
  r20's tag and on the rehearsal; upstream gives this job 32 CPUs and 64 GB.
  A probe run on theorem-labs/lean4 (run 46126841398, 2026-11-28) got that
  label in the organization's runner group `proofs`, with 16 CPUs and 62 GiB
  as `free -g` counts. Elsewhere (sjawhar/lean4, where the label does not
  exist) the job keeps ubuntu-latest. Its `-j2` stays: the bound is the
  memory of the TSAN tests, and 64 GB is upstream's memory too. The job has
  no `timeout-minutes` of its own (GitHub's 360 minutes); it built in about 54
  minutes on the 4-CPU hosted runner.
- Linux aarch64 and Linux fsanitize are unchanged.

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer
@legion-implementer legion-implementer Bot added the changelog-compiler Compiler, runtime, and FFI label Nov 28, 2026
@legion-implementer

Copy link
Copy Markdown
Author

Release rehearsal: run 46160867934 passed on integration commit 9fddac80674ec8fa262b6720bb79ba745dd6ddf1, which includes this reviewed head f5c9ddada881daf5c5be5a4e80d4ed544049c186. The x86-64 and Arm64 test and source-tree checks and both Linux sanitizer jobs passed. The final release commit will have its own release CI run.

@legion-implementer
legion-implementer Bot marked this pull request as ready for review November 28, 2026 20:21
legion-implementer Bot added a commit that referenced this pull request Nov 28, 2026
…LEAN_GITHASH (#6)

* ci: tag-build dispatch, no fork release assets, tests without LEAN_GITHASH

This member changes only `.github/`.

A dispatch of `ci.yml` with the new input `release_tag` builds as the run on
that tag would, before the tag exists:

    gh workflow run ci.yml --ref <branch> -f release_tag=v4.36-machcsl-r21

The step "Check for custom releases" of `configure` gives the input as its
output, so the run has check level 3, `stamped` builds, the job matrix and
target stage of the tag's run, and the same CMake options: a fork's tag gives
the build no `RELEASE_TAG` and no special version, so in both runs the version
stamp is the commit's githash. "Pack" compresses as on a tag. `IS_NIGHTLY` is
false whenever `release_tag` is set: the `action` input defaults to "release
nightly", and a dispatch with `release_tag` must take no nightly path.

The `release` job runs only on a tag push to leanprover/lean4. On a fork it
attached the CI's build artifacts to the tag's release. A fork's release holds
only the files that are published by hand (on theorem-labs/lean4, the measured
tarball and its `.sha256`), so the job no longer runs there. A dispatch is no
tag push, so it publishes nothing.

The steps "Test" and "Check rebootstrap" run the tests without `LEAN_GITHASH`.
The step "Build Stage 0 & Configure Stage 1" writes it to `GITHUB_ENV` (line
158 of build-template.yml at the trunk, line 163 in v4.36-machcsl-r20) from
`build/stage1/lake-githash`: the stage0 tree hash. `stdlib.make` passes that
value to the core build itself; the Lake cache steps (Download, Upload and
Verify Lake Cache, which run `build/stage0/bin/lake`) take it from the job's
environment (leanprover#14486). A stamped build runs none of these cache
steps (`lake-cache` is `!stamped`).

The tests of stage 2 (and of stage 1) do not need it: they run that stage's own
Lake and Lean, and with no override Lake takes the githash of that Lean (`lean
--githash`), as it does outside CI. Both stages are built with `USE_GITHASH`,
so that githash is the commit's, and the override names another Lean. Under
it, Lake scopes its remote cache by the override and queues, claims and reads
nothing remote (`remoteCacheQueueService?` in `Lake/Config/Env.lean`). That
failed the Lake tests inputLockClaims (cases 9a and 9b), remoteCacheClaim,
remoteCacheRead, remoteCacheRefused, remoteCachePush and usageCutoffRemote in
the job "build / Linux release" on the tag v4.36-machcsl-r20. Outside CI, the
runner's value of the variable gives the same failures, and without it the
tests pass (remoteCachePush's failing check needs a CMake build to reach). The
tests ran without the variable before leanprover#14486. "Check
rebootstrap" (which the Linux release job runs at check level 1 and up, so on a
tag, after "Test") exported the new stage0 hash for its stage 1 tests as a
defensive measure against stale builds (leanprover#14575). Without the
override Lake still keys every trace by the githash of the Lean it runs, which
the update-stage0 commit changes, so no test reuses a stale build.

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer

* ci: validate release_tag, keep it out of shell source, fork-only

Review of the previous commit found that the `release_tag` input reached
`GITHUB_OUTPUT` as typed, and that "Set check level" put that output into
its Bash source: a line break could change the step's outputs, and shell
metacharacters could change what Bash runs.

"Check for custom releases", the only step that reads the input, now takes
it as environment data and refuses it unless it is a tag name: `v` and then
letters, digits, `.`, `_` or `-` (`^v[0-9A-Za-z._-]+$`). The error names the
rule and prints the refused value escaped with `printf %q`, on one line.
"Set check level" no longer reads the tag text: it reads whether that step
gave a tag, as the Boolean `CUSTOM_RELEASE`. This also covers a fork's tag
push, whose name the step passed into Bash source in the same way. The other
places that read the input (`IS_NIGHTLY` in `configure`, "Pack" in
build-template.yml) use it only in a Boolean expression.

The input is for forks. On leanprover/lean4 the step refuses it with an
error, where before such a dispatch silently built at check level 1; the
input's description says so.

A dispatch with `release_tag` has a concurrency group of its own (the
group gets the suffix `-release-tag`), so that it and a nightly re-release
dispatch on the same ref no longer cancel each other.

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer

* ci: fork tag build without macOS aarch64 and Windows tests, tsanitize on 64 GB

The decision on the jobs of the fork's tag build other than Linux release
(LINUX-1736, E3(5)), applied in the build matrix of `configure`. "The fork's
tag build" is a fork's tag push or a dispatch with `release_tag`: the runs
in which "Check for custom releases" gives a tag, which the matrix script
now reads as the Boolean `forkTag`. On every other event (pull_request,
merge_group, a push to master, schedule, a nightly, leanprover/lean4's own
tags) the matrix is unchanged.

- macOS aarch64 and Windows: not tested in the fork's tag build; they still
  build there, as a compile check. With `test` false their Test step does
  not run, nor the steps that only read its results (Protect and Unprotect
  Source Tree, Check Source Tree Clean, Embed Test Output, Test Summary,
  Check Test Binary, all conditioned on `matrix.test` or on the Test step's
  conclusion in build-template.yml, which is unchanged). The fork publishes
  no macOS or Windows build. On r20's tag 27 Lake tests and
  elab/openssl.lean failed on macOS aarch64: the fork's Lake tests assume
  GNU tools and a newer bash than macOS's bash 3.2, and the runner's OpenSSL
  is 4. The fork's tests assume a POSIX system, so Windows failed 40 tests in
  a rehearsal of r21's tag build; #12 keeps its build working.
- Linux tsanitize: in theorem-labs/lean4's tag build it runs on the GitHub
  larger runner `ubuntu-24.04-16core` (16 CPUs, 64 GB). On ubuntu-latest the
  runner was lost about 39 s into elab/async_http_h1_incremental.lean, on
  r20's tag and on the rehearsal; upstream gives this job 32 CPUs and 64 GB.
  A probe run on theorem-labs/lean4 (run 46126841398, 2026-11-28) got that
  label in the organization's runner group `proofs`, with 16 CPUs and 62 GiB
  as `free -g` counts. Elsewhere (sjawhar/lean4, where the label does not
  exist) the job keeps ubuntu-latest. Its `-j2` stays: the bound is the
  memory of the TSAN tests, and 64 GB is upstream's memory too. The job has
  no `timeout-minutes` of its own (GitHub's 360 minutes); it built in about 54
  minutes on the 4-CPU hosted runner.
- Linux aarch64 and Linux fsanitize are unchanged.

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer

* ci: fork tag build only on a tag push or a release_tag dispatch

Review of the previous commit found that a `workflow_dispatch` from a
tag ref without `release_tag` (for example a nightly re-release, the
`action` input's default) also counted as the fork's tag build: "Check
for custom releases" runs on any tag ref of a fork and gives the ref's
tag name, so `forkTag` was true, and that dispatch lost the tests of
macOS aarch64 and Windows and, on theorem-labs/lean4, moved Linux
tsanitize to the larger runner.

`forkTag` now also requires a tag push (`push` of a `refs/tags/` ref) or
a dispatch whose `release_tag` is not empty. The check level is selected
as before.

The comment on Linux tsanitize now says only what is known: on
ubuntu-latest the runner was lost about 39 s into
elab/async_http_h1_incremental.lean (on r20's tag and on a rehearsal of
r21's), the larger runner is for its memory, the probe run 46126841398
got `ubuntu-24.04-16core` on theorem-labs/lean4, so the workflow selects
it only there, and the job keeps upstream's `-j2`, which upstream uses on
64 GB, the same memory. It no longer says that the label exists nowhere
else, nor that memory bounds the tests.

Rendered with the matrix script of `configure`: a tag push on
theorem-labs/lean4, a `release_tag` dispatch on sjawhar/lean4 and a pull
request give the same matrix as with the previous commit; a dispatch from
a tag ref without `release_tag`, on either repository, gives the matrix of
the commit before it again.

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer

* ci: no Lake cache upload where the repository has no cache endpoint

The pull requests within the fork failed at `Upload Lake Cache`, before
their tests ran. The step's condition leaves out only pull requests from
other repositories, but the fork has neither the secret LAKE_CACHE_KEY
nor the variable LAKE_CACHE_ENDPOINT. So `lake cache put` ran with an
empty key and the endpoint `/a1`, and stopped with "curl produced invalid
JSON ... Enter host password" and "URL using bad/illegal format", exit 1.

The step now also needs `vars.LAKE_CACHE_ENDPOINT != ''`. Where the
variable is set, as on leanprover/lean4, nothing changes. `Verify Lake
Cache` and `Restore Build` run only after a successful upload, so they
are skipped too. `Download Lake Cache` stays as it is: it reads
Reservoir, not that endpoint, and it is `continue-on-error` (on the fork
it stops in about two seconds with "no outputs found for any revision").

Part of LINUX-1736.

Omp-Session: 01a21fea-50cc-71ef-b840-72b8c7ab62bb
Legion-Role: implementer

---------

Co-authored-by: legion-implementer[bot] <343353655+legion-implementer[bot]@users.noreply.github.com>
@legion-implementer
legion-implementer Bot merged commit 1d05e4d into fork/v4.36-lazy-import-names-r21 Nov 28, 2026
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-compiler Compiler, runtime, and FFI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants