Skip to content

First example-hello with dune#4101

Open
elefthei wants to merge 6 commits intofstar2from
lef/dune-example-hello
Open

First example-hello with dune#4101
elefthei wants to merge 6 commits intofstar2from
lef/dune-example-hello

Conversation

@elefthei
Copy link

Add --dep dune support and migrate examples/hello to dune

Summary

Adds a new --dep dune output format to fstar.exe that generates (rule ...) stanzas suitable for inclusion in dune build files. Migrates examples/hello/ (Hello and multifile)
from the old Makefile-based build to dune as a reference example.

What's new

--dep dune output format (src/parser/FStarC.Parser.Dep.fst)

  • New print_dune function generates dune rules for .checked verification and OCaml/krml extraction
  • Filters already-cached modules (Prims, FStar.*) from dependency lists so dune rules only reference local targets
  • Handles .checked file paths in dep lists via strip_checked_suffix before module name resolution

Filepath.make_relative_to utility (src/basic/, src/ml/)

  • Computes relative paths between two absolute paths, used by print_dune for output file references

examples/hello/ dune migration

  • dune-project, per-subdirectory dune files with (include dune.deps.inc) and (executable ...) stanzas
  • Makefile wraps dune build: generates dune.deps.inc via fstar.exe --dep dune, then calls dune build
  • make clean removes generated files

Usage

Generate dune dependency rules

fstar.exe --dep dune --already_cached 'Prims FStar' Hello.fst --extract 'OCaml:Hello' > dune.deps.inc

Build from examples/hello/

cd examples/hello && make

|| Options.any_dump_module()
then (
if debug_fly_deps ()
if Debug.any()
Copy link
Contributor

Choose a reason for hiding this comment

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

Regression, revert.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link

Copilot AI commented Feb 13, 2026

@elefthei I've opened a new pull request, #4102, to work on those changes. Once the pull request is ready, I'll request review from you.

@gebner
Copy link
Contributor

gebner commented Feb 13, 2026

Can we make cd examples/hello && dune build work without any setup? Calling a complicated fstar.exe command before isn't a good option.

@@ -1,38 +0,0 @@
(*
Copy link
Contributor

Choose a reason for hiding this comment

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

Also what's up with deleting the F# test? (I realize that we don't run it during CI, but it still serves as a template to see how it should work.)

Copy link
Author

Choose a reason for hiding this comment

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

Is F# supported fully, or dropped fully?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ha, good question : ) Neither, currently.

@elefthei
Copy link
Author

The complicated fstar.exe command produces the dependency graph as a dune file. Maybe we could add it itself to dune

@gebner
Copy link
Contributor

gebner commented Feb 13, 2026

Maybe we could add it itself to dune

That would be ideal.

@elefthei elefthei force-pushed the lef/dune-example-hello branch from cf045ca to 2f8d83b Compare February 14, 2026 09:20
@elefthei elefthei force-pushed the lef/dune-example-hello branch from 2f8d83b to 245e0bb Compare February 14, 2026 09:26
@elefthei
Copy link
Author

Cool, only dune build now no Makefile.

@elefthei elefthei changed the base branch from master to fstar2 February 24, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants