diff --git a/deps/Makefile b/deps/Makefile index 0cf7df9967..be45ca2a74 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -11,9 +11,9 @@ endif PROXYSQLCLICKHOUSE := $(shell echo $(PROXYSQLCLICKHOUSE)) ifeq ($(PROXYSQLCLICKHOUSE),1) -default: libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre clickhouse-cpp lz4 cityhash microhttpd curl libev +default: libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre clickhouse-cpp lz4 cityhash microhttpd curl ev else -default: libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre microhttpd curl libev +default: libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre microhttpd curl ev endif .PHONY: default @@ -22,7 +22,7 @@ libev/libev/.libs/libev.a: cd libev && tar -zxf libev-4.24.tar.gz cd libev/libev && ./configure cd libev/libev && CC=${CC} CXX=${CXX} ${MAKE} -libev: libev/libev/.libs/libev.a +ev: libev/libev/.libs/libev.a curl/curl/lib/.libs/libcurl.a: diff --git a/src/Makefile b/src/Makefile index 2dc3f27776..5342acd396 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,10 +44,14 @@ CURL_DIR=$(DEPS_PATH)/curl/curl/ CURL_IDIR=$(CURL_DIR)/include CURL_LDIR=$(CURL_DIR)/lib/.libs +EV_DIR=$(DEPS_PATH)/libev/libev/ +EV_IDIR=$(EV_DIR) +EV_LDIR=$(EV_DIR)/.libs + IDIR=../include LDIR=../lib -IDIRS=-I$(IDIR) -I$(JEMALLOC_IDIR) -I$(MARIADB_IDIR) $(LIBCONFIG_IDIR) -I$(DAEMONPATH_IDIR) -I$(SQLITE3_DIR) -I$(CLICKHOUSE_CPP_DIR) -I$(MICROHTTPD_IDIR) -I$(CURL_IDIR) -LDIRS=-L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(CURL_LDIR) +IDIRS=-I$(IDIR) -I$(JEMALLOC_IDIR) -I$(MARIADB_IDIR) $(LIBCONFIG_IDIR) -I$(DAEMONPATH_IDIR) -I$(SQLITE3_DIR) -I$(CLICKHOUSE_CPP_DIR) -I$(MICROHTTPD_IDIR) -I$(CURL_IDIR) -I$(EV_IDIR) +LDIRS=-L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(CURL_LDIR) -L$(EV_DIR) UNAME_S := $(shell uname -s) @@ -68,9 +72,9 @@ MYCXXFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG) $(PSQLCH) LDFLAGS+= NOJEMALLOC := $(shell echo $(NOJEMALLOC)) ifeq ($(NOJEMALLOC),1) -MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lmicrohttpd -lcurl -Wl,-Bdynamic -lpthread -lm -lz -lrt -lcrypto -lssl $(EXTRALINK) +MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lmicrohttpd -lcurl -lev -Wl,-Bdynamic -lpthread -lm -lz -lrt -lcrypto -lssl $(EXTRALINK) else -MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -ljemalloc -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lmicrohttpd -lcurl -Wl,-Bdynamic -lpthread -lm -lz -lrt -lcrypto -lssl $(EXTRALINK) +MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -ljemalloc -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lmicrohttpd -lcurl -lev -Wl,-Bdynamic -lpthread -lm -lz -lrt -lcrypto -lssl $(EXTRALINK) endif ifeq ($(UNAME_S),Darwin) diff --git a/src/main.cpp b/src/main.cpp index 09237ee463..693d13a17f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ #include #include #include +#include "ev.h" // MariaDB client library redefines dlerror(), see https://mariadb.atlassian.net/browse/CONC-101 #ifdef dlerror @@ -393,6 +394,13 @@ void ProxySQL_Main_init_main_modules() { GloMyMon=NULL; GloMyLogger=NULL; GloMyStmt=NULL; + + // initialize libev + if (!ev_default_loop (EVBACKEND_POLL | EVFLAG_NOENV)) { + fprintf(stderr,"could not initialise libev"); + exit(EXIT_FAILURE); + } + MyHGM=new MySQL_HostGroups_Manager(); GloMTH=new MySQL_Threads_Handler(); GloMyLogger = new MySQL_Logger();