-
Notifications
You must be signed in to change notification settings - Fork 469
"Rule failed to generate the following targets" with virtual package #4195
Description
I am working on the JavaScript support for a package called bls12-381 implementing the curve BLS12-381 using a Rust optimized implementation.
The initial version of the package bls12-381 was only for UNIX, and was using an intermediate Rust dependency called rustc-bls12-381.
The JavaScript part uses jsoo to call a wasm version of the rust code given above.
I decided to go with the following structure:
- bls12-381 -> virtual package. Code located under
src/virtual - bls12-381-unix -> UNIX version, implementing bls12-381, using the rust code compiled into a static library. Code located under
src/unix - bls12-381-js -> JavaScript version, implementing bls12-381, using jsoo to wrap a NPM package containing the wasm code and providing a JavaScript layer above this wasm code. Code located under
src/js, mostly callingbls12-381-js-genundersrc/js-gen.
Intermediate packages are used for modularity/to ease the implementation of UNIX/JS support (bls12-381-gen, bls12-381-js-gen). So the structure is more:
- bls12-381-gen
-> bls12-381
| --> bls12-381-js-gen
| | --> bls12-381-js
| --> bls12-381-unix
When building and running the tests with dune build @runtest, everything is fine. However, when I try to install with opam (see below), I get a bunch of the following error for different files:
# Error: Rule failed to generate the following targets:
# - src/unix/.bls12_381_unix.objs/native/bls12_381.cmx
Expected Behavior
Compile without errors.
Actual Behavior
$ opam install bls12-381-unix
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[bls12-381-unix.dev] no changes from file:///home/danny/codes/dannywillems/ocaml-bls12-381
The following actions will be performed:
∗ install bls12-381-unix dev*
[bls12-381-unix.dev] synchronised from file:///home/danny/codes/dannywillems/ocaml-bls12-381
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of bls12-381-unix failed at "/home/danny/.opam/opam-init/hooks/sandbox.sh build dune build -j 3 -p bls12-381-unix @install".
#=== ERROR while compiling bls12-381-unix.dev =================================#
# context 2.0.6 | linux/x86_64 | ocaml-base-compiler.4.09.1 | pinned(file:///home/danny/codes/dannywillems/ocaml-bls12-381)
# path ~/codes/dannywillems/ocaml-bls12-381/_opam/.opam-switch/build/bls12-381-unix.dev
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -j 3 -p bls12-381-unix @install
# exit-code 1
# env-file ~/.opam/log/bls12-381-unix-1063079-d2c37b.env
# output-file ~/.opam/log/bls12-381-unix-1063079-d2c37b.out
### output ###
# [...]
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/unix/.bls12_381_unix.objs/byte/bls12_381__G2.cmi
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/unix/.bls12_381_unix.objs/byte/bls12_381__Pairing.cmi
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/unix/.bls12_381_unix.objs/native/bls12_381.cmx
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/unix/.bls12_381_unix.objs/native/bls12_381.o
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build bls12-381-unix dev
└─
╶─ No changes have been performed
$ opam install bls12-381-js
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[bls12-381-js.dev] synchronised from file:///home/danny/codes/dannywillems/ocaml-bls12-381
[bls12-381-js] Installing new package description from upstream file:///home/danny/codes/dannywillems/ocaml-bls12-381
The following actions will be performed:
∗ install bls12-381-js-gen dev* [required by bls12-381-js]
∗ install bls12-381-js dev*
===== ∗ 2 =====
Do you want to continue? [Y/n] Y
[bls12-381-js.dev] synchronised from file:///home/danny/codes/dannywillems/ocaml-bls12-381
[bls12-381-js-gen.dev] synchronised from file:///home/danny/codes/dannywillems/ocaml-bls12-381
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed bls12-381-js-gen.dev
[ERROR] The compilation of bls12-381-js failed at "/home/danny/.opam/opam-init/hooks/sandbox.sh build dune build -j 3 -p bls12-381-js @install".
#=== ERROR while compiling bls12-381-js.dev ===================================#
# context 2.0.6 | linux/x86_64 | ocaml-base-compiler.4.09.1 | pinned(file:///home/danny/codes/dannywillems/ocaml-bls12-381)
# path ~/codes/dannywillems/ocaml-bls12-381/_opam/.opam-switch/build/bls12-381-js.dev
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -j 3 -p bls12-381-js @install
# exit-code 1
# env-file ~/.opam/log/bls12-381-js-1063579-038aac.env
# output-file ~/.opam/log/bls12-381-js-1063579-038aac.out
### output ###
# [...]
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/js/.bls12_381_js.objs/byte/bls12_381__Fr.cmi
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/js/.bls12_381_js.objs/byte/bls12_381__G1.cmi
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/js/.bls12_381_js.objs/byte/bls12_381__G2.cmi
# File "src/dune_rules/virtual_rules.ml", line 40, characters 30-37:
# Error: Rule failed to generate the following targets:
# - src/js/.bls12_381_js.objs/byte/bls12_381__Pairing.cmi
Reproduction
git clone https://gitlab.com/dannywillems/ocaml-bls12-381 && cd ocaml-bls12-381opam switch create . 4.09.1 --no-install
2b.git checkout remove-pin-depends# temporary, require a MR to be merged in ocaml/opam-repository
2c.opam pin add tezos-rust-libs.1.1 "git+https://gitlab.com/tezos/tezos-rust-libs.git#f0a269087fe86dbe1cf471bb76e42fb4a481e226"# temporary, like 2b.opam pin add bls12-381-gen.dev ./ --no-actionopam pin add bls12-381.dev . --no-actionopam pin add bls12-381-unix.dev . --no-actionopam pin add bls12-381-js-gen . --no-actionopam pin add bls12-381-js . --no-actionopam install bls12-381-gen --with-testopam install bls12-381 --with-testopam instal bls12-381-unix --with-test# will fail with the error above.opam instal bls12-381-js-gen --with-test# fine.opam instal bls12-381-js --with-test# will fail, with the error above.
However, when using dune build @runtest, it does work fine.
Specifications
- Version of
dune(output ofdune --version):2.8.2 - Version of
ocaml(output ofocamlc --version):4.09.1 - Operating system (distribution and version): ubuntu 20.04
- Version of
opam:2.06.