[ocaml-ctypes] Build help

Andre Nathan andre at digirati.com.br
Wed Aug 10 21:20:17 BST 2016


Hi

I have working ctypes bindings for MariaDB's libmysqlclient at

  https://github.com/andrenth/ocaml-mariadb

I basically copied and adapted the project structure from

  https://github.com/simonjbeaumont/ocaml-flock

to get stub generation working. Currently I'm doing

  let foreign name typ = foreign name typ
    ~from:Dl.(dlopen ~filename:"libmysqlclient.so" ~flags:[RTLD_NOW])

to avoid getting a build error:

  Fatal error: exception
Dl.DL_error("/home/andre/.opam/4.03.0/lib/stublibs/dllctypes-foreign-base_stubs.so:
undefined symbol: mysql_server_init")

I'd like to get rid of that, and from googling I found the suggestion of
adding "CCOpt: -Wl,-no-as-needed" (I'm on Ubuntu) to the _oasis file,
but that didn't seem to make a difference.

I'm also not sure if that suggestion if still current, and the
repositories I found on github with a similar structure don't seem to be
using that option. They don't seem to be using the dlopen trick either,
so I'm guessing there's some other way to fix this.

Any help would be greatly appreciated.

Best regards,
Andre

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ocaml.org/pipermail/ctypes/attachments/20160810/3ba52049/attachment.sig>


More information about the Ctypes mailing list