Using ocsigenserver/eliom with sqlite3 on mac osx

I’m a long time linux user who just switched to using a mac, and I’m running into a problem getting my eliom projects to launch on ocsigenserver when using sqlite or pgsql for the persistent data backend (PERSISTENT_DATA_BACKEND = sqlite in my Makefile.options file for my eliom project).

Error from make test.byte:

ocsigenserver -c local/etc/<eliom_project_name>/<eliom_project_name>-test.conf

ocsigenserver: main: Fatal - While loading /Users/<my_comp_name>/.opam/default/lib/sqlite3/sqlite3.cma: error loading shared library: error loading shared library: Failure("dllsqlite3_stubs.so: dlopen(dllsqlite3_stubs.so, 0x000A): tried: 'dllsqlite3_stubs.so' (no such file), '/usr/local/lib/dllsqlite3_stubs.so' (no such file), '/usr/lib/dllsqlite3_stubs.so' (no such file), '/Users/<my_comp_name>/<eliom_project_name>/web/dllsqlite3_stubs.so' (no such file), '/usr/local/lib/dllsqlite3_stubs.so' (no such file), '/usr/lib/dllsqlite3_stubs.so' (no such file)")

make: *** [test.byte] Error 52

My sqlite3 module works just fine on its own. I’ve tried all the mac specific items mentioned at GitHub - mmottl/sqlite3-ocaml: OCaml bindings to the SQLite3 database, but no luck.

Have any other mac/eliom users run into this issue?

Thanks!

The stubs for the bytecode library of sqlite.cma are not found. They should be in $(opam var lib)/stublibs so this should be in your ocaml bytecode stub load path, see the manual here.

Maybe you are just missing an eval $(opam env) in your shell. This should setup CAML_LD_LIBRARY_PATH to point to the directory mentioned above. Check that env | grep CAML_LD_LIBRARY_PATH has the directory in which the missing stubs resides and try to run your program again.

Thanks, this helped me partially solve the issue. I created a symlink to the needed sqlite stubs file directly in the ocsigen project, which allows the project to compile and run. My env and CAML_LD_LIBRARY_PATH variable are setup correctly, but it seems that ocsigenserver is just not looking for the stubs file in that directory. I’ll keep digging around and post something here when I find a fix.

There is also a fancy opam feature that allows to investigate which files have been installed by opam: opam show sqlite3 --list-files.

Out of curiosity, what is the reason ocisgenserver being a bytecode executable instead of a native one?

Cheers,
Nicolas