Module: check_mk
Branch: master
Commit: 41ea2950084f46b0cac8efcd34fbf1d6f0ba839e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41ea2950084f46…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Feb 12 13:53:41 2018 +0100
Really link RE2 statically.
Change-Id: I4df30ea20b1ade391e2b1aa95b92d3537cf3c1bd
---
configure.ac | 2 +-
livestatus/src/Makefile.am | 5 +++--
omd/packages/re2/Makefile | 11 ++++++-----
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index c63a3f3..4665ff2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,7 +135,7 @@ AS_IF([test "x$want_re2" = "xyes"],
LDFLAGS_SAVED=$LDFLAGS
LDFLAGS="$LDFLAGS $RE2_LDFLAGS"
LIBS_SAVED=$LIBS
- LIBS="$LIBS $RE2_LIBS"
+ LIBS="$LIBS $RE2_LIBS -pthread"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <re2/re2.h>]],
[[RE2::FullMatch("hello",
"e")]])],
[AC_MSG_RESULT([yes])],
diff --git a/livestatus/src/Makefile.am b/livestatus/src/Makefile.am
index 6a854b2..6d8537b 100644
--- a/livestatus/src/Makefile.am
+++ b/livestatus/src/Makefile.am
@@ -164,11 +164,12 @@ liblivestatus_a_CPPFLAGS = -I.. @BOOST_CPPFLAGS@ @RE2_CPPFLAGS@
liblivestatus_a_CXXFLAGS = -fPIC
livestatus.o: $(liblivestatus_a_OBJECTS)
-# Note: libstdc++fs is only available as a static library, so we are lucky
+# Note: libstdc++fs is only available as a static library, so we are lucky. For
+# RE2 we make sure that this is the case, too.
$(CXXLINK) -shared $^ -lstdc++fs -lpthread -static-libstdc++ @BOOST_LDFLAGS@
@BOOST_ASIO_LIB@ @RE2_LDFLAGS@ @RE2_LIBS@
# To make sure we can dlopen() our NEB later
$(CXX) $(liblivestatus_a_CXXFLAGS) $(CXXFLAGS) -c NagiosMockup.cc -o NagiosMockup.o
- $(CXX) $(liblivestatus_a_CXXFLAGS) $(CXXFLAGS) NagiosMockup.o $@ -o NagiosMockup
@RE2_LDFLAGS@ @RE2_LIBS@
+ $(CXX) $(liblivestatus_a_CXXFLAGS) $(CXXFLAGS) NagiosMockup.o $@ -o NagiosMockup
$(RM) NagiosMockup
compile_commands.json: Makefile $(wildcard *.cc *.h)
diff --git a/omd/packages/re2/Makefile b/omd/packages/re2/Makefile
index 832fe82..427d7de 100644
--- a/omd/packages/re2/Makefile
+++ b/omd/packages/re2/Makefile
@@ -23,13 +23,16 @@ build: unpack
echo "no"; IFS=$$SAVED_IFS ; \
done ; \
test -z "$$CXX" && { echo "error: no C++ compiler found"
>&2 ; exit 1; } ; \
- $(MAKE) -C $(DIR) CXX="$$CXX" CPPFLAGS="-DRE2_ON_VALGRIND"
DESTDIR=$(PACKAGE_RE2_DESTDIR) prefix=$(OMD_ROOT) install
+ $(MAKE) -C $(DIR) CXX="$$CXX" CPPFLAGS="-DRE2_ON_VALGRIND"
CXXFLAGS="-O3 -g -fPIC" DESTDIR=$(PACKAGE_RE2_DESTDIR) prefix=$(OMD_ROOT)
install
+# Note: We need the -fPIC above to link RE2 statically into livestatus.o.
# TODO(sp): What should we do about RE2_ON_VALGRIND?
# Massage paths a bit by moving things around.
mv $(PACKAGE_RE2_DESTDIR)/$(OMD_ROOT)/include $(PACKAGE_RE2_DESTDIR)/$(OMD_ROOT)/lib
$(PACKAGE_RE2_DESTDIR)
rm -rf $(PACKAGE_RE2_DESTDIR)/$(OMD_BASE)
-# The RE2 Makefile offers no mechanism to strip the libraries. :-/
- strip $(PACKAGE_RE2_DESTDIR)/lib/*.a $(PACKAGE_RE2_DESTDIR)/lib/*.so
+# To link statically against RE2, we must *only* see the static library at link
+# time. It is a bit wasteful to build the dynamic library, too, but RE2's
+# Makefile doesn't offer an easy way around that.
+ $(RM) $(PACKAGE_RE2_DESTDIR)/lib/*.so*
unpack:
tar xzf $(DIR).tar.gz
@@ -39,8 +42,6 @@ unpack:
done
install:
- mkdir -p $(DESTDIR)$(OMD_ROOT)
- cp -a $(PACKAGE_RE2_DESTDIR)/include $(PACKAGE_RE2_DESTDIR)/lib $(DESTDIR)$(OMD_ROOT)
skel: