arbipher / ocaml-build-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Currently, it's just some random notes.

reference

on stublib https://discuss.ocaml.org/t/what-is-using-shared-stublibs/4638

how to find the shared.so

  1. set rpath at library building time 1.a hacking lib.so building no works

1.b hacking .cm{a,s,xs} building

  1. set rpath at client buildingtime add to META
linkopts = "-ccopt -Wl,-rpath,/home/exx/.opam/4.12.0.many/lib/stublibs"

It works for opt but not bc. Understandable. In opt the linker regards this rpath, however; in bc. the lib is dynamic loaded without a linking stage.

  1. set dllpath ocamlc ... -dllpath $$(opam var stublibs) It works for bc but not opt.

Understandable.

  1. set LD_LIBRARY_PATH It works for both bc and opt.

Understandable.

Impression: ocamlmklib and ocamlfind can work separately. There must be one place to telling the path of shared lib to the final binary.

$ make api/ml/z3ml.cma
ocamlmklib -o api/ml/z3ml -I api/ml -L. api/ml/z3native_stubs.o api/ml/z3enums.cmo api/ml/z3native.cmo api/ml/z3.cmo  -lz3-static -lstdc++

This will gen dllz3ml.so and libz3ml.a

About


Languages

Language:SMT 89.6%Language:OCaml 9.1%Language:Makefile 0.8%Language:C++ 0.5%Language:DTrace 0.1%Language:Standard ML 0.0%Language:Python 0.0%