zshipko / ocaml-rust-starter

Getting started with ocaml-rs
ISC License
31 stars 4 forks source link

Cargo.lock issues #4

Open mimoo opened 3 years ago

mimoo commented 3 years ago

With a simple project I get this error:

error: failed to open: /Users/davidwong/Perso/dalek-ocaml/x25519/_build/default/dalek-wrapper/target/release/.cargo-lock

the dune file:

; don't copy target to _build

(dirs :standard \ dalek-wrapper/target dalek-wrapper/Cargo.lock)

; creates the rust library if any rust file changes

(rule
 (target libdalek_wrapper.a)
 (deps
  (source_tree dalek-wrapper))
 (action
  (progn
   (run cargo build --release --manifest-path dalek-wrapper/Cargo.toml)
   (run cp dalek-wrapper/target/release/libdalek_wrapper.a .))))

My guess is that Cargo.lock shouldn't be copied to the _build directory, but my (dirs trick doesn't seem to work.

mimoo commented 3 years ago

Actually deleting the target directory fixes the issue, but I'm not sure why it gets copied in the first place since it's in (dirs :standard \

I guess this repo doesn't have this issue because the dune file is within src/