]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
global: Make breakpad code compile-time conditional on HAVE_BREAKPAD
authorMarcel Lauhoff <marcel.lauhoff@clyso.com>
Thu, 16 Jan 2025 09:24:09 +0000 (10:24 +0100)
committerMarcel Lauhoff <marcel.lauhoff@clyso.com>
Tue, 13 May 2025 10:40:15 +0000 (12:40 +0200)
Only build breakpad code if we build with breakpad support. Print
warning if breakpad enabled in config, but not built.

Signed-off-by: Marcel Lauhoff <marcel.lauhoff@clyso.com>
src/common/ceph_context.h
src/global/global_init.cc

index 14e157f41c6f7fa635ef24989cf0829d4c8e97ce..df96ae68dcb9939b209843b087fdbffad40d4410 100644 (file)
@@ -34,7 +34,9 @@
 #include "common/cmdparse.h"
 #include "common/code_environment.h"
 #include "msg/msg_types.h"
+#ifdef HAVE_BREAKPAD
 #include "breakpad/src/client/linux/handler/exception_handler.h"
+#endif
 #ifdef WITH_CRIMSON
 #include "crimson/common/config_proxy.h"
 #include "crimson/common/perf_counters_collection.h"
@@ -144,7 +146,9 @@ public:
 
   ConfigProxy _conf;
   ceph::logging::Log *_log;
+#ifdef HAVE_BREAKPAD
   std::unique_ptr<google_breakpad::ExceptionHandler> _ex_handler;
+#endif
 
   /* init ceph::crypto */
   void init_crypto();
index 839951249c9b7aa433e0cd2aa40dd5142555fe2f..46e05916bd4cc8d60f4dc9fa2b0b2f3cd7e2d974 100644 (file)
 #include "extblkdev/ExtBlkDevPlugin.h"
 #include "global/global_context.h"
 #include "global/global_init.h"
+#ifdef HAVE_BREAKPAD
 #include <client/linux/handler/minidump_descriptor.h>
 #include <google_breakpad/common/minidump_format.h>
+#endif
 #include "global/pidfile.h"
 #include "global/signal_handler.h"
 #include "include/compat.h"
@@ -180,6 +182,7 @@ void global_pre_init(
   g_conf().complain_about_parse_error(g_ceph_context);
 }
 
+#ifdef HAVE_BREAKPAD
 static bool dumpCallback(
     const google_breakpad::MinidumpDescriptor& descriptor, void* context,
     bool succeeded) {
@@ -188,6 +191,7 @@ static bool dumpCallback(
   dout_emergency(buf);
   return succeeded;
 }
+#endif
 
 boost::intrusive_ptr<CephContext>
 global_init(const std::map<std::string,std::string> *defaults,
@@ -227,11 +231,18 @@ global_init(const std::map<std::string,std::string> *defaults,
     install_standard_sighandlers();
   }
 
+#ifdef HAVE_BREAKPAD
   if (g_conf()->breakpad) {
     google_breakpad::MinidumpDescriptor descriptor(g_conf()->crash_dir);
     g_ceph_context->_ex_handler.reset(
        new google_breakpad::ExceptionHandler(descriptor, nullptr, dumpCallback, nullptr, true, -1));
   }
+#else
+  if (g_conf()->breakpad) {
+    cerr << "breakpad crash reporting requested, but disabled at build time"
+         << std::endl;
+  }
+#endif
 
   ceph::register_assert_context(g_ceph_context);