From 58ca2d3920a2c9ff3671f158def02c23876d3301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 16 Aug 2018 07:08:59 +0200 Subject: [PATCH] Statically link curl on OSX #1560 --- INSTALL.md | 9 +++++++++ src/Makefile | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 3d22f5ce1..72de8a291 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -35,6 +35,15 @@ yum install automake bzip2 cmake make gcc-c++ gcc git openssl openssl-devel patc apt-get install automake bzip2 cmake make g++ gcc git openssl libssl-dev patch ``` +On Mac OSX, Proxysql's dependencies are not fully satisfied by the tools included with the XCode/clang toolkit. The Proxysql build system needs to be told where to find non-system `curl` (and possibly `openssl`) libraries. Using the [Homebrew](https://brew.sh/) OSX package manager, dependencies can be installed and located on OSX like this: + +```bash +brew install automake bzip2 cmake make git gpatch openssl curl +export OPENSSL_ROOT_DIR="$(brew --prefix openssl)" +export CXXFLAGS="${CXXFLAGS:-} -I$(brew --prefix openssl)/include -I$(brew --prefix curl)/include" +export LDFLAGS="${LDFLAGS:-} -L$(brew --prefix openssl)/lib" +``` + Go to the directory where you cloned the repo (or unpacked the tarball) and run: ```bash diff --git a/src/Makefile b/src/Makefile index 1ba06c732..d305edafe 100644 --- a/src/Makefile +++ b/src/Makefile @@ -88,6 +88,10 @@ endif ifeq ($(UNAME_S),Darwin) MYLIBS=-lssl -lre2 -lmariadbclient -lpthread -lm -lz -liconv -lcrypto -lcurl +else + CURL_DIR=$(DEPS_PATH)/curl/curl + IDIRS+= -L$(CURL_DIR)/include + LDIRS+= -L$(CURL_DIR)/lib/.libs endif ifeq ($(UNAME_S),Linux) MYLIBS+= -ldl @@ -98,7 +102,7 @@ endif LIBPROXYSQLAR=$(LDIR)/libproxysql.a ifeq ($(UNAME_S),Darwin) - LIBPROXYSQLAR=$(LDIR)/libproxysql.a ../deps/libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a ../deps/pcre/pcre/.libs/libpcre.a ../deps/pcre/pcre/.libs/libpcrecpp.a ../deps/libdaemon/libdaemon/libdaemon/.libs/libdaemon.a ../deps/libconfig/libconfig/lib/.libs/libconfig++.a ../deps/libconfig/libconfig/lib/.libs/libconfig.a ../deps/sqlite3/sqlite3/sqlite3.o + LIBPROXYSQLAR=$(LDIR)/libproxysql.a ../deps/libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a ../deps/pcre/pcre/.libs/libpcre.a ../deps/pcre/pcre/.libs/libpcrecpp.a ../deps/libdaemon/libdaemon/libdaemon/.libs/libdaemon.a ../deps/libconfig/libconfig/lib/.libs/libconfig++.a ../deps/libconfig/libconfig/lib/.libs/libconfig.a ../deps/curl/curl/lib/.libs/libcurl.a ../deps/sqlite3/sqlite3/sqlite3.o endif LIBPROXYSQLAR+= $(SSL_LDIR)/libssl.a $(SSL_LDIR)/libcrypto.a