ocaml / ocaml/dune

Explicit executable dependencies and cross-compilation

Open
#3,917 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

acknowledged cross-compilation
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

When packages use configure scripts, they usually have something like this:

rule
  (targets ...)
  (deps discover.exe)
  (action (run ./discover.exe)))

As of today, this does not work in a cross-compilation setting, because it adds a dependency towards config.exe in the cross-compiled workspace, which is not a good thing (and fails due to missing unix, usually).

My guess is that dune performs the following expansions:

  • (deps discover.exe) -> (deps %{dep:discover.exe}) -- pointing to the cross-compiled workspace
  • (run ./discover.exe) -> (run %{exe:./discover.exe}) -- pointing to the host workspace (as intended)

A simple workaround is to remove the explicit deps field towards executables, but that might seem counter-intuitive to some package maintainers so I was wondering if this behavior was intended. Thanks !

Using dune master branch and ocaml 4.11.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source files or tests. Start by reproducing the configure-script rule during cross-compilation and trace how explicit executable dependencies and (run ...) expressions are expanded. Done means the intended host-versus-target dependency behavior is established and covered by an appropriate regression test or documented clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.