I have a file called Facebook.ml in my that uses the Https_client module from the Netclient library. I have compiled the file to Facebook.cmo and I can use all functions without any problem in the toplevel and in other code that I compile.
However, ocsigenserver is unable to find the Https_client module within the Netclient library and when I test my ocsigen build with make test.byte
I recieve the error
ocsigenserver -c local/etc/UC/UC-test.conf
ocsigenserver: main: Fatal - While loading /home/.../Facebook.cmo: error while linking /home/.../Facebook.cmo.
ocsigenserver: main: Reference to undefined global `Https_client'
make: *** [test.byte] Error 52
I have added the following line to my .conf.in file:
<library module="/home/.../Facebook.cmo" />
I am compiling Facebook.ml with
ocamlfind ocamlc -thread -package core,equeue-ssl,netclient,lwt -linkpkg Facebook.ml
What am I doing incorrectly?
Following Drup's advice I updated my Makefile.options file to
PROJECT_NAME := UC
# Source files for the server
SERVER_FILES := UC.ml Facebook.cmo
# Source files for the client
CLIENT_FILES := $(wildcard *.eliomi *.eliom)
# OCamlfind packages for the server
SERVER_PACKAGES := home/alpha/.opam/4.01.0/lib/netclient/netclient.cma
# OCamlfind packages for the client
CLIENT_PACKAGES :=
Receiving the error:
Fatal error: exception Fl_package_base.No_such_package("home/alpha/.opam/4.01.0/lib/netclient/netclient.cma", "")
make: *** [_server/Facebook.cmo] Error 2
But I know that the file does exist at the specified filepath. Do I need to add the path anywhere else?
You have various solutions:
Makefile.options
instead. Add the file in SERVER_FILES
and the needed libraries in SERVER_PACKAGES
. It will also compile your files by itself.<extension findlib-package="netclient"/>
to make ocsigenserver load the netclient
library.I strongly advise the first one.
Also, if you want an http client, there is one inside ocsigenserver but you should probably use cohttp (especially considering ocsigenserver itself will soon use it).