From 00f94a98ba4ce70a3cabb7aa5dec8410f4f44bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 20 Aug 2023 03:55:08 +0000 Subject: [PATCH] Again statically linking libcurl --- test/tap/tap/Makefile | 12 ++++++------ test/tap/tests/Makefile | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/test/tap/tap/Makefile b/test/tap/tap/Makefile index b1299c6cbc..8091bab9dd 100644 --- a/test/tap/tap/Makefile +++ b/test/tap/tap/Makefile @@ -38,27 +38,27 @@ OPT=-O2 debug: OPT = -O0 -DDEBUG -ggdb debug: libtap.a libtap.so -command_line.o: command_line.cpp +command_line.o: command_line.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a g++ -fPIC -c command_line.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) -utils.o: utils.cpp +utils.o: utils.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a g++ -fPIC -c utils.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) -tap.o: tap.cpp +tap.o: tap.cpp cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a g++ -fPIC -c tap.cpp -std=c++11 $(INCLUDEDIRS) $(OPT) libtap.a: tap.cpp tap.h command_line.cpp command_line.h utils.cpp utils.h tap.o command_line.o utils.o cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a - ar rcs libtap.a tap.o command_line.o utils.o $(SQLITE3_LDIR)/sqlite3.o $$(find $(DOTENV_DIR)/ -name '*.o') + ar rcs libtap.a tap.o command_line.o utils.o $(SQLITE3_LDIR)/sqlite3.o libtap.so: tap.cpp tap.h command_line.cpp command_line.h utils.cpp utils.h tap.o command_line.o utils.o cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so - g++ -shared -o libtap.so tap.o command_line.o utils.o $(SQLITE3_LDIR)/sqlite3.o + gcc -shared -o libtap.so -Wl,--whole-archive libtap.a ../../../deps/curl/curl/lib/.libs/libcurl.a ../../../deps/libssl/openssl/libcrypto.a ../../../deps/libssl/openssl/libssl.a -Wl,--no-whole-archive cpp-dotenv/static/cpp-dotenv/libcpp_dotenv.a: cd cpp-dotenv/static && rm -rf cpp-dotenv-*/ || true cd cpp-dotenv/static && tar -zxf ../cpp-dotenv-*.tar.gz cd cpp-dotenv/static/cpp-dotenv && patch src/dotenv.cpp < ../../dotenv.cpp.patch cd cpp-dotenv/static/cpp-dotenv && patch include/dotenv.h < ../../dotenv.h.patch - cd cpp-dotenv/static/cpp-dotenv && cmake . -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug + cd cpp-dotenv/static/cpp-dotenv && cmake . -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Debug cd cpp-dotenv/static/cpp-dotenv && CC=${CC} CXX=${CXX} ${MAKE} cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so: diff --git a/test/tap/tests/Makefile b/test/tap/tests/Makefile index b2aff3b180..615932b82e 100644 --- a/test/tap/tests/Makefile +++ b/test/tap/tests/Makefile @@ -26,10 +26,9 @@ LIBCONFIG_PATH=$(DEPS_PATH)/libconfig/libconfig LIBCONFIG_IDIR=$(LIBCONFIG_PATH)/lib LIBCONFIG_LDIR=-L$(LIBCONFIG_PATH)/lib/.libs -# Disabling CURL , we will use the OS one -#CURL_DIR=$(DEPS_PATH)/curl/curl -#CURL_IDIR=$(CURL_DIR)/include -#CURL_LDIR=$(CURL_DIR)/lib/.libs +CURL_DIR=$(DEPS_PATH)/curl/curl +CURL_IDIR=$(CURL_DIR)/include +CURL_LDIR=$(CURL_DIR)/lib/.libs DAEMONPATH=$(DEPS_PATH)/libdaemon/libdaemon DAEMONPATH_IDIR=$(DAEMONPATH) @@ -72,7 +71,8 @@ TAP_LIBDIR=../tap DOTENV_DYN_DIR=../tap/cpp-dotenv/dynamic/cpp-dotenv DOTENV_DYN_IDIR=$(DOTENV_DYN_DIR)/include -DOTENV_DYN_LDIR=$(DOTENV_DYN_DIR) +#DOTENV_DYN_LDIR=$(DOTENV_DYN_DIR) +DOTENV_DYN_LDIR=$(TAP_LIBDIR) LIBPROXYSQLAR=$(LDIR)/libproxysql.a @@ -82,8 +82,8 @@ EXECUTABLE=proxysql OBJ=../../../src/obj/proxysql_global.o ../../../src/obj/main.o ../../../src/obj/proxy_tls.o -INCLUDEDIRS=-I../tap -I$(RE2_PATH) -I$(IDIR) -I$(JEMALLOC_IDIR) -I$(SQLITE3_DIR) -I$(MICROHTTPD_IDIR) -I$(LIBHTTPSERVER_IDIR) -I$(DAEMONPATH_IDIR) -I$(MARIADB_IDIR) -I$(SSL_IDIR) -I$(JSON_IDIR) -I$(LIBCONFIG_IDIR) -I$(PROMETHEUS_IDIR) -I$(EV_IDIR) -I$(DOTENV_DYN_IDIR) -LDIRS=-L$(TAP_LIBDIR) -L$(DOTENV_DYN_LDIR) -L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(LIBHTTPSERVER_LDIR) -L$(LIBINJECTION_LDIR) -L$(EV_LDIR) -L$(SSL_LDIR) -L$(PROMETHEUS_LDIR) +INCLUDEDIRS=-I../tap -I$(RE2_PATH) -I$(IDIR) -I$(JEMALLOC_IDIR) -I$(SQLITE3_DIR) -I$(MICROHTTPD_IDIR) -I$(LIBHTTPSERVER_IDIR) -I$(CURL_IDIR) -I$(DAEMONPATH_IDIR) -I$(MARIADB_IDIR) -I$(SSL_IDIR) -I$(JSON_IDIR) -I$(LIBCONFIG_IDIR) -I$(PROMETHEUS_IDIR) -I$(EV_IDIR) -I$(DOTENV_DYN_IDIR) +LDIRS=-L$(TAP_LIBDIR) -L$(DOTENV_DYN_LDIR) -L$(LDIR) -L$(JEMALLOC_LDIR) $(LIBCONFIG_LDIR) -L$(RE2_PATH)/obj -L$(MARIADB_LDIR) -L$(DAEMONPATH_LDIR) -L$(PCRE_LDIR) -L$(MICROHTTPD_LDIR) -L$(LIBHTTPSERVER_LDIR) -L$(LIBINJECTION_LDIR) -L$(CURL_LDIR) -L$(EV_LDIR) -L$(PROMETHEUS_LDIR) UNAME_S := $(shell uname -s) @@ -91,7 +91,8 @@ ifeq ($(UNAME_S),Linux) LDIRS+= -L$(COREDUMPER_LDIR) endif -MYLIBS=-Wl,--export-dynamic -Wl,-Bdynamic -lssl -lcrypto -lgnutls -ltap -lcpp_dotenv -lcurl -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lhttpserver -lmicrohttpd -linjection -lev -lprometheus-cpp-pull -lprometheus-cpp-core -luuid -Wl,-Bdynamic -lpthread -lm -lz -lrt -ldl $(EXTRALINK) +MYLIBS=-Wl,--export-dynamic -Wl,-Bdynamic -lssl -lcrypto -lgnutls -ltap -lcpp_dotenv -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lhttpserver -lmicrohttpd -linjection -lcurl -lev -lprometheus-cpp-pull -lprometheus-cpp-core -luuid -Wl,-Bdynamic -lpthread -lm -lz -lrt -ldl $(EXTRALINK) +#MYLIBS=-Wl,--export-dynamic -Wl,-Bdynamic -lssl -lcrypto -lgnutls -ltap -lcpp_dotenv -Wl,-Bstatic -lconfig -lproxysql -ldaemon -lconfig++ -lre2 -lpcrecpp -lpcre -lmariadbclient -lhttpserver -lmicrohttpd -linjection -lev -lprometheus-cpp-pull -lprometheus-cpp-core -luuid -Wl,-Bdynamic -lpthread -lm -lz -lrt -ldl $(EXTRALINK) MYLIBSJEMALLOC=-Wl,-Bstatic -ljemalloc STATIC_LIBS= $(CITYHASH_LDIR)/libcityhash.a #STATIC_LIBS= $(SSL_LDIR)/libssl.a $(SSL_LDIR)/libcrypto.a $(CITYHASH_LDIR)/libcityhash.a @@ -209,7 +210,7 @@ reg_test_3504-change_user_libmariadb_helper: reg_test_3504-change_user_helper.cp reg_test_3504-change_user_libmysql_helper: reg_test_3504-change_user_helper.cpp $(CXX) -DLIBMYSQL_HELPER -DDEBUG reg_test_3504-change_user_helper.cpp -I/usr/include/mysql -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap -L$(TAP_LIBDIR) -lpthread -ldl -std=c++11 -ltap -lmysqlclient -o reg_test_3504-change_user_libmysql_helper -DGITVERSION=\"$(GIT_VERSION)\" -CUSTOMARGS=-DGITVERSION=\"$(GIT_VERSION)\" -I$(SQLITE3_DIR) -I$(IDIR) -I$(JSON_IDIR) -I../tap -L$(TAP_LIBDIR) -Wl,-Bstatic -ltap -lcurl -Wl,-Bdynamic -lpthread -std=c++11 -ldl +CUSTOMARGS=-DGITVERSION=\"$(GIT_VERSION)\" -I$(SQLITE3_DIR) -I$(IDIR) -I$(CURL_IDIR) -I$(JSON_IDIR) -I../tap -L$(TAP_LIBDIR) -L$(CURL_LDIR) -Wl,-Bstatic -lcurl -Wl,-Bdynamic -ltap -lcpp_dotenv -lpthread -std=c++11 -lz -ldl test_clickhouse_server_libmysql-t: test_clickhouse_server-t.cpp $(CXX) -DLIBMYSQL_HELPER -DDEBUG test_clickhouse_server-t.cpp -I/usr/include/mysql $(CUSTOMARGS) -lmysqlclient -o test_clickhouse_server_libmysql-t