ocaml / ocaml/dune

modes not respected in combination with library with public_name

Open
#3,467 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

With a dune file such as:

(env
 (_
  (flags ())))

(subdir
 lib
 (library
  (name test_lib)
  (public_name test_package.test_lib)
  (modes native)))

(executable
 (name test_exe)
 (public_name test_exe)
 (package test_package)
 (libraries test_lib)
 (modes native))

I expect that executing dune build will not run ocamlc on implementation files. I realize that it might compile interface files with ocamlc even when building for native code only.

Actual Behavior

In the case above, dune build does run ocamlc on implementation files. Curiously, if (public_name test_package.test_lib) is removed, it does not.

Reproduction

Here is a small project that shows this: dune-bc-test.tar.gz

Specifications

  • Version of dune (output of dune --version): 2.5
  • Version of ocaml (output of ocamlc --version): 4.08.1
  • Operating system (distribution and version): macos 10.14.6

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

Start by unpacking dune-bc-test.tar.gz and running dune build with the shown dune files to confirm the extra ocamlc compilation. Read the build actions for the interaction between public_name and modes, then add a regression test following HACKING.md. Done means native-only builds no longer compile implementation files with ocamlc in this case.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.