Skip to content

Commit

Permalink
Fix TAP tests compilation with GCOV
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JavierJF committed Mar 22, 2024
1 parent 44db1df commit 7149369
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/tap/tap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7149369

Please sign in to comment.