10000 feat: add `lean_setup_libuv` for initializing required LIBUV components by algebraic-dev · Pull Request #8636 · leanprover/lean4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add lean_setup_libuv for initializing required LIBUV components #8636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

algebraic-dev
Copy link
Member

This PR adds a function called lean_setup_libuv that initializes required LIBUV components. It needs to be outside of lean_initialize_runtime_module because it requires a 8000 rgv and argc to work correctly.

@algebraic-dev algebraic-dev self-assigned this Jun 4, 2025
@algebraic-dev algebraic-dev added the changelog-compiler Compiler, runtime, and FFI label Jun 4, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 4, 2025
@leanprover-community-bot
Copy link
Collaborator
leanprover-community-bot commented Jun 4, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase e08b2a1f62238f7f817c719e4fffcfef14243338 --onto c12159b51982221bdd66f0c5997f85e1f9d91772. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-04 23:23:00)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase e08b2a1f62238f7f817c719e4fffcfef14243338 --onto 0a9c24649767dea857a388e5385b7ae94bfd0185. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-12 16:00:12)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase e08b2a1f62238f7f817c719e4fffcfef14243338 --onto db499e96aac8ad654c8ed5ab40c4e6885d38c9a1. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-20 23:13:14)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase e08b2a1f62238f7f817c719e4fffcfef14243338 --onto d3dda9f6d4428a906c096067ecb75e432afc4615. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-26 13:02:30)

@algebraic-dev algebraic-dev marked this pull request as ready for review June 5, 2025 01:38
@eric-wieser
Copy link
Contributor

This presumably makes progress on #5819 ?

@algebraic-dev
Copy link
Member Author

This presumably makes progress on #5819 ?

Not exactly, LibUV provides some functions like uv_exepath that can get the executable path but it's not exactly the same as argv[0]

Copy link
Member
@TwoFX TwoFX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FFI changes LGTM except for the documentation comments. I didn't check the compiler changes.

algebraic-dev and others added 3 commits June 26, 2025 09:33
Co-authored-by: Markus Himmel <markus@lean-fro.org>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
doc/dev/ffi.md Outdated
@@ -131,14 +131,21 @@ Thus `[init]` functions are run iff their module is imported, regardless of whet

The initializer for module `A.B` is called `initialize_A_B` and will automatically initialize any imported modules.
Module initializers are idempotent (when run with the same `builtin` flag), but not thread-safe.

**Important for process-related functionality**: If your application needs to use process-related functions from libuv, such as `getProcessTitle` and `setProcessTitle`, you must call `lean_setup_libuv(argc, argv)` (which returns a potentially modified `argv` that must be used in place of the original) **before** calling `lean_initialize()` or `lean_initialize_runtime_module()`. This sets up libuv's process handling capabilities correctly, as it internally invokes `uv_setup_args`, which is essential for certain system-level operations that Lean's runtime may depend on.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is getProcessTitle a lean function name? What namespace is it in?

Copy link
Member Author
@algebraic-dev algebraic-dev Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's going to be added in #8072. It's in the Std.Internal.IO.Process namespace.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong PR? That's about DNS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry it's #8109.

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 toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0