I'm doing a project in OCaml and I'm trying to use Ocamlnet. I'm using ocamlbuild
for the build. Here's my build command line:
ocamlbuild -use-ocamlfind -pkgs threads,yojson,str,postgresql,netcgi2 \
-cflags -g,-thread -lflags -g,-thread -classic-display test.byte
When I build my project, I'm getting this link error:
+ /usr/bin/ocamlfind ocamlc -g -thread -linkpkg -package netcgi2 -package postgresql -package str -package threads -package yojson cgi.cmo data.cmo util.cmo persist.cmo setup.cmo test.cmo -o test.byte
File "_none_", line 1, characters 0-1:
Error: Error while linking /usr/lib/ocaml/netsys/netsys.cma(Netsys_posix):
The external function `netsys_have_sem' is not available
Command exited with code 2.
I'm not using anything from Netsys_posix
directly, but my code references Netchannels
and Netcgi_cgi
.
I'm using Debian Wheezy (7) and installing packages with the distro package manager. The version of OCaml is 3.12.1. Here's the list of OCaml-related packages I have installed, in case it's relevant (apologies for running them all together on one line, but putting each on its own line seemed like an excessive use of space):
libapache2-mod-ocamlnet libbatteries-ocaml-dev libbatteries-ocaml-doc libbiniou-ocaml libbiniou-ocaml-dev libcalendar-ocaml libcalendar-ocaml-dev libcamomile-ocaml-data libcamomile-ocaml-dev libcryptgps-ocaml-dev libcryptokit-ocaml libcryptokit-ocaml-dev libcsv-ocaml-dev libderiving-ocsigen-ocaml libderiving-ocsigen-ocaml-dev libeasy-format-ocaml libeasy-format-ocaml-dev libeliom-ocaml libeliom-ocaml-dev libfindlib-ocaml libfindlib-ocaml-dev libjs-of-ocaml libjs-of-ocaml-dev liblwt-ocaml liblwt-ocaml-dev liblwt-ocaml-doc liblwt-ssl-ocaml liblwt-ssl-ocaml-dev libnethttpd-ocaml-dev libocamlnet-ocaml libocamlnet-ocaml-dev libocamlnet-ocaml-doc libocsigen-ocaml libocsigen-ocaml-doc libocsigen-xhtml-ocaml-dev libocsigenserver-ocaml libocsigenserver-ocaml-dev libpcre-ocaml libpcre-ocaml-dev libpostgresql-ocaml libpostgresql-ocaml-dev libreact-ocaml libreact-ocaml-dev libsqlite3-ocaml libsqlite3-ocaml-dev libssl-ocaml libssl-ocaml-dev libtext-ocaml libtext-ocaml-dev libtyxml-ocaml libtyxml-ocaml-dev libyojson-ocaml libyojson-ocaml-dev libzip-ocaml libzip-ocaml-dev ocaml ocaml-base ocaml-base-nox ocaml-batteries-included ocaml-findlib ocaml-interp ocaml-nox ocamlduce ocamlduce-base
How can I get my build to work?
Is this an error on my part (in my build) or is it a Debian packaging bug?
UPDATE:
I downloaded the latest OCaml (4.01.0) and OPAM (1.1.1), built them from source and installed them in /opt, then used OPAM to install the needed libraries. Now I get a very similar result but naming a different missing function:
+ ocamlfind ocamlc -g -thread -linkpkg -package netsys -package netcgi2 -package postgresql -package str -package yojson -package threads cgi.cmo data.cmo util.cmo persist.cmo setup.cmo test.cmo -o test.byte
File "_none_", line 1:
Error: Error while linking /home/nate/.opam/system/lib/netsys/netsys.cma(Netsys_posix):
The external function `caml_ba_dim_1' is not available
Command exited with code 2.