zshipko / ocaml-rs

OCaml extensions in Rust
https://docs.rs/ocaml
ISC License
259 stars 31 forks source link

Please update the book with tips for linking in C libraries #112

Open emchristiansen opened 1 year ago

emchristiansen commented 1 year ago

Could you please update the book with tips for linking in C libraries?

E.g. I'm trying to wrap an existing OCaml library to make it callable form Rust, and I'm getting this error from Dune:

ld: cannot find -lrt: No such file or directory
ld: cannot find -lgmp: No such file or directory

I've tried a few attempts at getting Dune to find these libraries, but I'm not very familiar with how Dune works.

Since I'm guessing 1) you've already solved this problem, and 2) it's likely to be a common issue, could you please add a note to the book explaining the magic Dune stanzas to use?

Thanks!

zshipko commented 1 year ago

I haven't run into this much as I use ocaml-rs for calling Rust from OCaml - I don't have a good solution right now but see https://github.com/zshipko/rust-ocaml-starter/pull/2#issuecomment-1428065726 for a workaround.