ocaml-community / ocaml-mariadb

OCaml bindings to MariaDB, supporting the nonblocking API
55 stars 18 forks source link

Building on macOS fails #15

Closed Leonidas-from-XIV closed 6 years ago

Leonidas-from-XIV commented 6 years ago

Hi,

I am trying to build things on macOS and the configure script fails. This is due to neither mysqlclient nor mariadb usually being in the library path (at least not when installing the connector via brew). The way to build things is to use mysql_config --cflags or mariadb_config --cflags, which will return the correct locations for building on both macOS as well as GNU/Linux systems, so I think it is better to use that than to attempt to compile a detect.c.

Leonidas-from-XIV commented 6 years ago

If you're interested, I can provide a pull request to adjust the build to use the configuration binaries.

andrenth commented 6 years ago

Seems like a good idea. For the PR you'll probably also need to use --libs for the mariadb_connector oasis flag.

donut commented 6 years ago

Looks like I'm running into this as well with v1.0.0 and opam install mariadb. v0.10.0 installs fine.

↪  opam install mariadb                                               0@12:02:34
The following actions will be performed:
  ∗  install mariadb 1.0.0

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

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
[ERROR] The compilation of mariadb failed at "make".
Processing  1/1: [mariadb: ocamlfind remove]
#=== ERROR while installing mariadb.1.0.0 =====================================#
# opam-version 1.2.2
# os           darwin
# command      make
# path         /Users/donovan/.opam/OCamURL-server/build/mariadb.1.0.0
# compiler     4.05.0
# exit-code    2
# env-file     /Users/donovan/.opam/OCamURL-server/build/mariadb.1.0.0/mariadb-28608-d2c37b.env
# stdout-file  /Users/donovan/.opam/OCamURL-server/build/mariadb.1.0.0/mariadb-28608-d2c37b.out
# stderr-file  /Users/donovan/.opam/OCamURL-server/build/mariadb.1.0.0/mariadb-28608-d2c37b.err
### stdout ###
# [...]
# Warning 40: raw was selected from type Common.t.
# It is not visible in the current scope, and will not
# be selected if the type becomes unknown.
# File "lib/blocking.ml", line 139, characters 46-49:
# Warning 40: raw was selected from type Common.t.
# It is not visible in the current scope, and will not
# be selected if the type becomes unknown.
# File "lib/blocking.ml", line 1:
# Error: Some fatal warnings were triggered (9 occurrences)
# Command exited with code 2.
### stderr ###
# W: Cannot find source file matching module 'Ffi_generated' in library mariadb.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# W: Cannot find source file matching module 'Ffi_generated_types' in library mariadb.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# E: Failure("Command ''/Users/donovan/.opam/OCamURL-server/bin/ocamlbuild' bindings/mariadb_bindings.cma bindings/mariadb_bindings.cmxa bindings/mariadb_bindings.a bindings/mariadb_bindings.cmxs lib/libmariadb_stubs.a lib/dllmariadb_stubs.so lib/mariadb.cma lib/mariadb.cmxa lib/mariadb.a lib/mariadb.cmxs stubgen/ffi_stubgen.byte stubgen/ffi_types_stubgen.byte examples/select/nonblocking_select_example.native examples/select/nonblocking_select_stress_test.native examples/blocking/blocking_example.native examples/blocking/blocking_stress_test.native -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [build] Error 1

=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  🐫
The following actions failed
  ∗  install mariadb 1.0.0
No changes have been performed
andrenth commented 6 years ago

Seems to happen with 4.05.0 though not with 4.06.0. I'll release a fix soon.

andrenth commented 6 years ago

I've just submitted 1.0.1 to opam, which should fix this.