Skip to content
Maël Valais edited this page Dec 28, 2018 · 2 revisions

Notes on making ocaml-qbf work

oasis: added -fPIC so that a shared stub can be created

Notes:

  • on mingw, -fPIC is ignored because all objects are created with position independent code. So this does not affect the windows build.
  • on macos, -fPIC is also ignored because in order to compile a position independent code, the (clang) argument is -fno-common -DPIC. But it seems to be working fine on macos without these flags.

fix the 'tag' warnings from ocamlbuild

If we don't specify OcamlVersion: >= 4.01.0, the tags in tags will use the 'pkg...' form. For some reason, ocamlbuild will cough over these unused tags (because we are sometimes not building with depqbf). If we force the use of ocaml >= 4.01.0, the package() form is used and the warnings seem to disappear.

These warnings have the form:

File _tags:
Warning: the tag "pkg_ctypes" is not used in any flag or dependency
declaration, so it will have no effect; it may be a typo. Otherwise
you can use `mark_tag_used` in your myocamlbuild.ml to disable this
warning.

The tags pkg_ctypes, pkg_ctypes.foreign and pkg_random-generator are only used when --enable-depqbf is enabled (this explains that).

I basically did what the warning says.


Dl error on macos

Fatal error: exception Dl.DL_error("dlsym(RTLD_DEFAULT, qdpll_delete): symbol not found")

In _oasis, in qbf-depqbf, I have changed

CCLib: -L/usr/local/lib/ -lqdpll

to

CCLib: "-force_load /usr/local/lib/libqdpll.a"

Help used: https://github.com/ocamllabs/ocaml-ctypes/issues/41


Having libffi (used by ctypes) not linked dynamically

https://github.com/ocamllabs/ocaml-ctypes/issues/20

My problem: when doing

otool -L ./touist.native

I was getting

./touist.native:
  /usr/local/opt/libffi/lib/libffi.6.dylib (compatibility version 7.0.0, current version 7.4.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)

This libffi was installed by brew install libffi, which means that I cannot give touist to some other mac user.