Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

How to keep static builds as is while adding ppx_expect support for dev/test builds?

$
0
0

Dear all, Cc @yurug @AltGr,

I have an issue related to dune, ppx_expect, and linking.

Context:

  • I’m working on learn-ocaml, to implement ppx_expect and ppx_inline_test support.
  • I added several unit tests in src/state/learnocaml_data.ml, in this PR.
  • So far, so good: the PR is ready and all our CI jobs (using GitHub Actions) are green;
    except the jobs for the Linux/macOS static builds.
  • Here is the error message (from this job):
    ...
    collect2: error: ld returned 1 exit status
    File "_none_", line 1:
    Error: Error while building custom runtime system
    
  • Locally, this can be reproduced by running ./scripts/static-build.sh

I suspect that removing

  (inline_tests)
  (preprocess (pps ppx_expect ppx_inline_test))

just for static builds would fix the issue? (do you think this is the case?)

Next, what I tried:

Replacing src/state/dune with:

...

(library
 (name learnocaml_data)
 (wrapped false)
 (modules Learnocaml_data)
 (libraries asak sha learnocaml_toplevel_history learnocaml_report learnocaml_repository)
  (enabled_if (= %{env:LINKING_MODE=dynamic} dynamic))
  (inline_tests)
  (preprocess (pps ppx_expect ppx_inline_test))
)

(library
 (name learnocaml_data)
 (wrapped false)
 (modules Learnocaml_data)
 (libraries asak sha learnocaml_toplevel_history learnocaml_report learnocaml_repository)
 (enabled_if (<> %{env:LINKING_MODE=dynamic} dynamic))
)

...

Unfortunately, I got:

File "src/state/dune", line 16, characters 19-44:
16 |   (enabled_if (= %{env:LINKING_MODE=dynamic} dynamic))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Only architecture, system, model, os_type, ccomp_type, profile,
ocaml_version and context_name variables are allowed in this 'enabled_if'
field. If you think that env should also be allowed, please file an issue
about it.

What solutions could workaround this? (ideally, feasible with the dune version we currently use: 2.9.0)

Thanks!

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles