Closed andreas closed 7 years ago
The whole MariaDB client library situation is a bit confusing right now... If you install MariaDB (up to 10.1) you get a libmariadbclient that is compatible with MySQL's libmysqlclient, so you get the include files in /usr/include/mysql
for example. If you install their C Connector, you end up with /usr/include/mariadb
.
The same is true for those constants, which exist in libmariadbclient but not in the C connector.
To further complicate things, it appears that starting with MariaDB 10.2, libmariadbclient will be obsolete, and using the C connector will be the supported way to do things. That's fine by me, but for some reason there's no C connector package (at least for Ubuntu) in their own repositories, unless I missed something.
Anyway, the correct way to fix all these issues would be to add some sort of preprocessing to try detect what client library is installed and use the correct paths. This seems too complicated though, and since the C Connector will be the right way to do things going forward, I'd be willing to only support that in the future. But it would be nice if MariaDB would at least add it to their repositories...
Oh, w.r.t /usr/local/lib/mariadb
, shouldn't brew have updated your /etc/ld.so.conf
or equivalent in OSX so that it's added to the library search path?
That does indeed sound confusing.
As far as I can tell, /usr/local/lib/mariadb
is not added automatically to the library search path by brew. I guess that you have to do that manually when linking.
I should also add: thanks a lot for putting together the library! It's great with a Lwt-enabled MySQL client (without Lwt_preemptive
).
Well, I've found a PPA for version 2.3.1 of the connector, and opened a request for them to backport the newer version to Ubuntu 16.04 (which only has version 2.0.0, which doesn't have the nonblocking functions).
So I guess I'll work on adapting the library to use the connector instead of libmariadbclient, since that'll be the future anyway. At least it should solve the mysql.h issue, and also get rid of those constants, so the installation process will be a bit easier for you.
I've removed the bindings to functions and flags that are absent in Connector/C, and changed the build infrastructure to detect dynamically if it should link to the connector's libmariadb or to libmysqlclient. Preference is given to the connector as it seems libmysqlclient will be deprecated starting in MariaDB 10.2.
Other than the /usr/local/lib/mariadb
issue, you should be able to keep your hair while installing the library :)
Please reopen if you find any problems.
You work fast π It works great. I can install 0.7.0
cleanly using opam (with the .dylib
symlinks in place). Thanks!
Awesome :smiley:
I'm running OSX 10.11.6 (El Capitan) and OCaml 4.03.0. I've installed MariaDB Connector/C 2.2.2 via Homebrew (
brew install mariadb-connector-c
).When trying to install
mariadb
via opam, I get the following error:It seems like
mysql.h
is undermariadb/mysql.h
in my setup. If I create a symlink to remedy this, I get the following error instead:i.e. the constant
MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
is not defined. To investigate this further, I checked out the repo and looked into this missing constant. As far as I can tell, the constantsMYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
andMYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY
are not defined in any header files in MariaDB Connector/C 2.2.2, nor in any other version I can find on the releases homepage.So to make it build, I tried removing use of those constants (and also changed the
mysql/mysql.h
tomariadb/mysql.h
): https://gist.github.com/andreas/0e580b19df542f1dbe1ee2676a2c6768With the above patch, I got a little further, but sadly still an error when trying to build:
It seems the problem is that brew puts
.dylib
's in/usr/local/lib/mariadb/
. I was able to fix it by symlinkinglibmysqlclient.dylib
,libmariadb.dylib
andlibmariadb.2.dylib
into/usr/local/lib
.As such, I got it working in the end, but it took quite some hairpulling π It would be great if the library installed cleanly via opam on OSX.