Installing mariadb from opam on FreeBSD
If this happens:
% opam install mariadb
[...]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of mariadb failed at
"/usr/home/albert/.opam/ocaml-base-compiler/.opam-switch/build/mariadb.1.1.4/./configure
--prefix=/usr/home/albert/.opam/ocaml-base-compiler".
#=== ERROR while compiling mariadb.1.1.4 ======================================#
# context 2.0.4 | freebsd/x86_64 | ocaml-base-compiler.4.09.0 | pinned(git+file:///usr/home/albert/ocaml-mariadb#master#b87c191b)
# path /usr/home/albert/.opam/ocaml-base-compiler/.opam-switch/build/mariadb.1.1.4
# command /usr/home/albert/.opam/ocaml-base-compiler/.opam-switch/build/mariadb.1.1.4/./configure --prefix=/usr/home/albert/.opam/ocaml-base-compiler
# exit-code 1
# env-file /usr/home/albert/.opam/log/mariadb-79214-6cc03f.env
# output-file /usr/home/albert/.opam/log/mariadb-79214-6cc03f.out
### output ###
# Could not detect a MariaDB client library
The first problem is that configure
tries to use gcc
, which you probably
don't have installed, and shouldn't be using anyway for compiling OCaml
libraries. So link gcc
to cc
somewhere:
ln -s /usr/bin/cc ~/bin/gcc
The second problem is that configure
doesn't manage to find the MariaDB
libraries because it doesn't look in the right places (or use mysql_config
as
it should). So use this instead:
CPATH="/usr/local/include/mysql:/usr/local/include/mysql/mysql:/usr/local/include" \
LIBRARY_PATH="/usr/local/lib/mysql:/usr/local/lib" \
opam install mariadb
That should make it work.