ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.57k stars 396 forks source link

No way to change compiler flags for `dune utop` or other toplevel builders #10632

Open OlivierNicole opened 1 month ago

OlivierNicole commented 1 month ago

In my fork of ppx_stage, I’m trying to launch a toplevel:

$ dune utop
File "_none_", line 1:              
Error (warning 32 [unused-value-declaration]): unused value modcontext''_.

I can’t address this warning right now, but I didn’t find a way to pass -warn-error -A to the underlying compiler command. Using a dedicated (toplevel ...) stanza doesn’t help, as it doesn’t take a (flags ...) parameter.

rgrinberg commented 1 month ago

You can use a different build profile as a workaround. Changing the compiler flags for utop isn't great because it will mean that you will need to rebuild everything just for the toplevel (unfortunately, changing the build profile also this disadvantage)

OlivierNicole commented 1 month ago

Well, the thing is, this is in the dev profile in which I set -warn-error -A in dune-workspace. It seems to be ignored.

emillon commented 1 week ago

As a workaround, you can use OCAMLPARAM=_,w=-32 dune utop