Skip to content

mdx targets do not get link flags #15613

Description

@samoht

Small repro:

$ cat dune-project
(lang dune 3.24)
(using mdx 0.4)

$ cat dune-workspace
(lang dune 3.24)
(env (dev (link_flags (:standard -cclib -Wl,-MARKER))))

$ cat dune
(mdx)
(executable (name main))

$ dune build @all --verbose 2>&1 | grep -E '^Running.*(main\.exe|mdx_gen)'
Running[5]: … ocamlc.opt -g -o mdx_gen.bc.exe -output-complete-exe … -linkall
Running[6]: … ocamlopt.opt … -o main.exe … -cclib -Wl,-MARKER

So main.exe gets the flag, butmdx_gen.bc.exe gets -g -linkall and nothing else. (as src/dune_rules/mdx.ml:507-513 passes a hardcoded ~link_args:(A "-linkall") and ~env:Env.empty).

The direct impact of this is that's once you start using mdx on macOS there is no way to disable this warning (while you can turn it off for other link steps):

  ld: warning: ignoring duplicate libraries: '-lzstd'

Metadata

Metadata

Labels

mdxRelated to the internal mdx plugin

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions