ocaml-community / ocaml-mariadb

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

installing mariadb on mac #44

Closed idkjs closed 2 years ago

idkjs commented 2 years ago

I am trying to install mariadb on mac and get the following error:

~/git/ocaml-caqti master
❯ opam install mariadb
The following actions will be performed:
  βˆ— install mariadb 1.1.4

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved mariadb.1.1.4  (cached)
[ERROR] The compilation of mariadb.1.1.4 failed at "./configure
        --prefix=/Users/zish/.opam/4.12.1".

#=== ERROR while compiling mariadb.1.1.4 ======================================#
# context     2.1.2 | macos/arm64 | ocaml-base-compiler.4.12.1 | https://opam.ocaml.org#71d8d30e
# path        ~/.opam/4.12.1/.opam-switch/build/mariadb.1.1.4
# command     ~/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix=/Users/zish/.opam/4.12.1
# exit-code   1
# env-file    ~/.opam/log/mariadb-55095-0e674d.env
# output-file ~/.opam/log/mariadb-55095-0e674d.out
### output ###
# Could not detect a MariaDB client library

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build mariadb 1.1.4
└─
╢─ No changes have been performed

~/git/ocaml-caqti master                                                ✘ 31 10s
❯ which mariadb
/opt/homebrew/bin/mariadb

 ~/git/ocaml-caqti ξ‚Ό master ξ‚° 

I have run opam update and opam upgrade. I have mariadb installed via brew.

Any suggestions on resolving this error would be greatly appreciated. Thank you.

UPDATE

I had been meaning to factory reset my machine so I went ahead and did that to erase the possibility that I had some config that was interfering. I get the same error:

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved mariadb.1.1.4  (cached)
-> removed   conf-mariadb.2
-> removed   conf-pkg-config.2
-> installed conf-pkg-config.2
-> installed conf-mariadb.2
[ERROR] The compilation of mariadb.1.1.4 failed at "./configure
        --prefix=/Users/mando/.opam/default".

#=== ERROR while compiling mariadb.1.1.4 ======================================#
# context     2.1.2 | macos/arm64 | ocaml.4.13.1 | https://opam.ocaml.org#28fab8d8
# path        ~/.opam/default/.opam-switch/build/mariadb.1.1.4
# command     ~/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix=/Users/mando/.opam/default
# exit-code   1
# env-file    ~/.opam/log/mariadb-28306-488530.env
# output-file ~/.opam/log/mariadb-28306-488530.out
### output ###
# Could not detect a MariaDB client library

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build mariadb 1.1.4
+- 
+- The following changes have been performed
| - recompile conf-mariadb    2
| - recompile conf-pkg-config 2
+- 

Thanks

ygrek commented 2 years ago
# Could not detect a MariaDB client library

ocaml-mariadb doesn't use pkg-config (probably should), so solution is the same as for all such bindings - make sure C compiler can find mariadb includes and libraries. On Linux it means setting/extending C_INCLUDE_PATH and LD_LIBRARY_PATH to point at appropriate directories, on mac it is C_INCLUDE_PATH and LIBRARY_PATH.