From 7149369bf197c852f061e29ca8d1c0c1b21a72ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Fri, 22 Mar 2024 18:08:36 +0100 Subject: [PATCH] Fix TAP tests compilation with GCOV With the addition of 'sha256_crypt_r' to 'libtap.a' it's required to advice the linker to link against 'gcov' when building the shared library. --- test/tap/tap/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/tap/tap/Makefile b/test/tap/tap/Makefile index d617a5e1f..3a4be0e59 100644 --- a/test/tap/tap/Makefile +++ b/test/tap/tap/Makefile @@ -60,6 +60,15 @@ endif OPT := $(STDCPP) -O2 -ggdb -Wl,--no-as-needed $(WASAN) +# NOTE-LWGCOV (LinkWithGCOV): +# Linking against GCOV is required when ProxySQL is build with support for it. This is because +# 'sha256crypt.oo' is being used for 'libtap.a'. This requisite is imposed due to 'sha256_crypt_r' +# being used inside ProxySQL linked 'SQLite3', which is also used by `libtap.so`. +LWGCOV := +ifeq ($(WITHGCOV),1) + LWGCOV := -lgcov +endif + ### main targets @@ -88,7 +97,7 @@ libtap.a: tap.o command_line.o utils.o cpp-dotenv/static/cpp-dotenv/libcpp_doten ar rcs libtap.a tap.o command_line.o utils.o $(SQLITE3_LDIR)/sqlite3.o $(PROXYSQL_LDIR)/obj/sha256crypt.oo libtap.so: libtap.a cpp-dotenv/dynamic/cpp-dotenv/libcpp_dotenv.so - $(CXX) -shared -o libtap.so -Wl,--whole-archive libtap.a -Wl,--no-whole-archive + $(CXX) -shared -o libtap.so -Wl,--whole-archive libtap.a -Wl,--no-whole-archive $(LWGCOV) ### tap deps targets