ygrek / ocaml-mysql

OCaml bindings to libmysqlclient
https://ygrek.org.ua/p/ocaml-mysql
GNU Lesser General Public License v2.1
23 stars 11 forks source link

opam install fails #8

Closed bruce-ricard closed 7 years ago

bruce-ricard commented 7 years ago

Hello,

I tried to install the library through opam, but it didn't work and got me this message back:

opam install mysql

The following actions will be performed:
  ∗  install mysql 1.2.1

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[mysql] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[ERROR] The compilation of mysql failed at "./configure --prefix /Users/bricar/.opam/4.02.3".
Processing  1/1: [mysql: ocamlfind remove]
#=== ERROR while installing mysql.1.2.1 =======================================#
# opam-version 1.2.2
# os           darwin
# command      ./configure --prefix /Users/bricar/.opam/4.02.3
# path         /Users/bricar/.opam/4.02.3/build/mysql.1.2.1
# compiler     4.02.3
# exit-code    1
# env-file     /Users/bricar/.opam/4.02.3/build/mysql.1.2.1/mysql-67407-1872ec.env
# stdout-file  /Users/bricar/.opam/4.02.3/build/mysql.1.2.1/mysql-67407-1872ec.out
# stderr-file  /Users/bricar/.opam/4.02.3/build/mysql.1.2.1/mysql-67407-1872ec.err
### stdout ###
# Options:
# [...]
#         --libs           [-L/usr/local/mysql/lib -lmysqlclient -lz -lm     -lmygcc]
#         --libs_r         [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm     -lmygcc]
#         --plugindir      [/usr/local/mysql/lib/plugin]
#         --socket         [/tmp/mysql.sock]
#         --port           [0]
#         --version        [5.1.72]
#         --libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -ldl  -lz -lm       -lmygcc]
# configure: checking for MySQL library...
# checking for mysql_real_connect in -lmysqlclient... no
### stderr ###
# configure: error: MySQL client library not found

I'm not sure what it means by "MySQL client library not found".

ygrek commented 7 years ago

It means libmysqlclient C library development headers are not installed. Use opam depext conf-mysql or install it manually (mysql-connector-c on osx, libmysqlclient-dev in debian, etc)

bruce-ricard commented 7 years ago

Thank you, that worked. Wouldn't it be possible to add this dependency to opam so that it does it automatically?

ygrek commented 7 years ago

It is already.

$ opam show -f depends mysql.1.2.1
ocamlfind & conf-mysql
$ opam show --raw  conf-mysql
[..]
depexts: [
  [["centos"] ["mysql-devel"]]
  [["debian"] ["libmysqlclient-dev"]]
  [["homebrew" "osx"] ["mysql-connector-c"]]
  [["ubuntu"] ["libmysqlclient-dev"]]
]

when install failed opam should have proposed to check missing external dependencies