From a5990ead2d418a9ac2d5f094540d7f67899b3245 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Wed, 3 Jan 2024 21:36:41 +0000 Subject: [PATCH] fix clang issue --- src/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index a3adbb3448..52a3d626ee 100644 --- a/src/Makefile +++ b/src/Makefile @@ -115,6 +115,16 @@ endif STDCPP := -std=c++$(shell echo $(CPLUSPLUS) | cut -c3-4) -DCXX$(shell echo $(CPLUSPLUS) | cut -c3-4) +### handle clang issue https://bugs.llvm.org/show_bug.cgi?id=16404 +CLANGFIX := +ifeq ($(CXX),clang++) + CLANG_VERSION := $(shell clang -dumpversion | tr '.' ' ' | awk '{ printf("%04d.%04d.%04d", $$1, $$2, $$3) }') + CLANG_MIN_VER := $(shell echo 14.0 | tr '.' ' ' | awk '{ printf("%04d.%04d.%04d", $$1, $$2, $$3) }') +ifneq ($(CLANG_MIN_VER),$(firstword $(sort $(CLANG_VERSION) $(CLANG_MIN_VER)))) + CLANGFIX := --rtlib=compiler-rt --unwindlib=libgcc +endif +endif + PSQLCH := ifeq ($(PROXYSQLCLICKHOUSE),1) PSQLCH := -DPROXYSQLCLICKHOUSE @@ -199,9 +209,9 @@ $(ODIR)/%.o: %.cpp $(EXECUTABLE): $(ODIR) $(OBJ) $(LIBPROXYSQLAR) ifeq ($(PROXYSQLCLICKHOUSE),1) - $(CXX) -o $@ $(OBJ) $(LIBPROXYSQLAR) $(CLICKHOUSE_CPP_LDIR)/libclickhouse-cpp-lib-static.a $(LZ4_LDIR)/liblz4.a $(MYCXXFLAGS) $(CXXFLAGS) $(LDIRS) $(LIBS) $(MYLIBS) + $(CXX) -o $@ $(OBJ) $(CLANGFIX) $(LIBPROXYSQLAR) $(CLICKHOUSE_CPP_LDIR)/libclickhouse-cpp-lib-static.a $(LZ4_LDIR)/liblz4.a $(MYCXXFLAGS) $(CXXFLAGS) $(LDIRS) $(LIBS) $(MYLIBS) else - $(CXX) -o $@ $(OBJ) $(LIBPROXYSQLAR) $(MYCXXFLAGS) $(CXXFLAGS) $(LDIRS) $(LIBS) $(MYLIBS) + $(CXX) -o $@ $(OBJ) $(CLANGFIX) $(LIBPROXYSQLAR) $(MYCXXFLAGS) $(CXXFLAGS) $(LDIRS) $(LIBS) $(MYLIBS) endif ifeq ($(UNAME_S),Darwin) shasum $(EXECUTABLE) > $(EXECUTABLE).sha1