Closed slegrand45 closed 9 years ago
AFAIU the "right thing" to do in this case is to have the freebsd host configured in the way so that /usr/local
is available to the compiler and linker by default. This is achieved by setting "site defaults" for configure, see https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html#Site-Defaults . One can also set the required search paths in the environment (either globally or for one opam invocation), e.g. env CPPFLAGS=-I/usr/local/include LDFLAGS=/usr/local/lib ...
. Does that sound like a right solution to you?
My wish is to be able to install the opam package without any manual intervention. I tried your suggestion with the "env" command. And it can be included in the opam file, like this:
opam-version: "1.2"
maintainer: "ygrek@autistici.org"
homepage: "http://ocaml-mysql.forge.ocamlcore.org"
doc: "http://ocaml-mysql.forge.ocamlcore.org/doc/index.html"
build: [
["./configure" "--prefix" "%{prefix}%"] { os != "freebsd" }
["env" "CPPFLAGS=-I/usr/local/include/mysql" "LDFLAGS=-L/usr/local/lib/mysql" "./configure" "--prefix" "%{prefix}%"] { os = "freebsd" }
[make]
[make "install"]
]
build-doc: [
[make "htdoc"]
]
remove: [
["ocamlfind" "remove" "mysql"]
]
depends: ["ocamlfind" "camlp4"]
depexts: [
[ [ "debian" ] [ "libmysqlclient-dev" ] ]
[ [ "ubuntu" ] [ "libmysqlclient-dev" ] ]
]
Do you think this solution could be ok?
I like this more than hardcoding search paths in configure..
BTW is that really -I/usr/local/include/mysql
and not -I/usr/local/include
?
And while we are at it - could you please check whether mysql_config
is available in PATH on FreeBSD and what is the output?
Yes, if you install FreeBSD MySQL port, the include directory is indeed /usr/local/include/mysql and the library directory is /usr/local/lib/mysql. mysql_config is installed in /usr/local/bin/ so it should be available in PATH. The output is the following:
% mysql_config
Usage: /usr/local/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/include/mysql -pipe -fno-strict-aliasing -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing]
--cxxflags [-I/usr/local/include/mysql -pipe -fno-strict-aliasing -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing]
--include [-I/usr/local/include/mysql]
--libs [-L/usr/local/lib/mysql -lmysqlclient -pthread -lm]
--libs_r [-L/usr/local/lib/mysql -lmysqlclient_r -pthread -lm]
--plugindir [/usr/local/lib/mysql/plugin]
--socket [/tmp/mysql.sock]
--port [0]
--version [5.6.21]
--libmysqld-libs [-L/usr/local/lib/mysql -lmysqld]
--variable=VAR VAR is one of:
pkgincludedir [/usr/local/include/mysql]
pkglibdir [/usr/local/lib/mysql]
plugindir [/usr/local/lib/mysql/plugin]
Thanks, I've updated the package in opam-repository and will be looking into using mysql_config for configuration
Hi,
The latest changes in configure files have removed the search for the directories where to find the MySQL library and the .h file. The problem is that it breaks the installation with opam on FreeBSD. libmysqlclient is located in /usr/local/lib/mysql/ and mysql.h in /usr/local/include/mysql/. For a manual installation it would be indeed easy for the user to fix the problem by adding the necessary options to configure. But for an automatic installation like with opam it's becoming really more annoying. Could it be possible to backtrack the changes and put again the search for the directories? Thanks. Regards, Stéphane.