Missing headers in leanc makes compiling certain FFI libraries painful
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - [ X] Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - [ X] Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
Lean comes with a C compiler called leanc, since Lean itself compiles down to C itself.
This is really useful!
However, leanc is missing a bunch of important C headers like stdio.h, which makes compiling certain very important C libraries like SQLite or SDL impossible without gcc or clang.
It would be nice to be able to add the full C standard library to be able to compile more stuff.
Context
#general > SQLite bindings for Lean @ 💬
Steps to Reproduce
N/A
Versions
Lean 4.24, Windows 11
Additional Information
I'm currently working on SQLite bindings for Lean, and I worked on SDL bindings for lean, so in the past, I've had to rely on solutions like using MSYS2 or WSL to compile such bindings on Windows, which is very inconvenient. It would be nice not to have to worry about such things and use Lean's built in C compiler.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the leanc entry point and reproduce the missing stdio.h case on Windows 11; the issue names no source file or test. Completion means the needed C standard headers are available for the SQLite or SDL FFI use case without relying on MSYS2 or WSL, with a regression test covering the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100