Add a way to pass the context CFLAGS to foreign build sandboxing
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
Hi there,
I am trying to compile some C code, using the foreign build sandboxing. This is working nicely, but now I would like to be able to tweak the C flags (for instance to use the ones defined in the current workspace context).
Is there a way to do that properly?
I've tried various things, but I only succeeded to make dune explode:
$ echo dune
(rule
(target foo)
(action (setenv X %{c_flags} (run echo 1))))
$ dune build ./foo
Error: exception { exn =
("Pform.Map.expand_exn",
{ t =
{ vars =
map
{ "-verbose" : No_info Values []
; "<" :
Deleted_in
"First_dep",(1, 0),[ "Use a named dependency instead:\n\
\n\
\ (deps (:x <dep>) ...)\n\
\ ... %{x}\n\
..."
]
[...]
Same for:
(rule
(target foo)
(action (run echo %{c_flags})))
Or with (with is what I wanted to use to pass %{c_flags} to the sandboxed ./configure script):
(rule
(target foo)
(action (bash "echo %{c_flags}")))
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 Dune's foreign build sandboxing and the sample rules using %{c_flags}, including the attempted with form for ./configure. Trace how context CFLAGS are exposed to sandboxed commands and define done as allowing the workspace flags to reach the foreign build without the reported Pform.Map.expand_exn failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100