add folly::init to libfolly for OSS build
authorWez Furlong <wez@fb.com>
Thu, 15 Dec 2016 04:03:32 +0000 (20:03 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 15 Dec 2016 04:18:11 +0000 (20:18 -0800)
Summary:
We use this in eden and this avoids needing to patch the homebrew recipe.

I've also made the use of the folly symbolizer specific to the facebook
internal build of folly, because it fails to compile in the Linux OSS build
too.

Reviewed By: yfeldblum

Differential Revision: D4292166

fbshipit-source-id: b69153be8ab9cc461bc7f456248e73972ba7f461

folly/Makefile.am
folly/init/Init.cpp

index 92bf03a03808cad782f059b422915500919f729d..bb87d5127ffc4afc537efc41fceac174214df190 100644 (file)
@@ -433,6 +433,7 @@ libfolly_la_SOURCES = \
        IPAddressV4.cpp \
        IPAddressV6.cpp \
        LifoSem.cpp \
+       init/Init.cpp \
        io/Compression.cpp \
        io/Cursor.cpp \
        io/IOBuf.cpp \
index 77bee6846b95b4be769f3277e0a2b9872ea1495b..434593aa0ec77999b86bd4835f65e00d9d0da6c3 100644 (file)
 #include <glog/logging.h>
 
 #include <folly/Singleton.h>
-#if !defined(__APPLE__) && !defined(_WIN32)
-#define USE_FOLLY_SYMBOLIZER 1
-#endif
 
-#ifdef USE_FOLLY_SYMBOLIZER
+#ifdef FOLLY_USE_SYMBOLIZER
 #include <folly/experimental/symbolizer/SignalHandler.h>
 #endif
 #include <folly/portability/GFlags.h>
@@ -31,7 +28,7 @@
 namespace folly {
 
 void init(int* argc, char*** argv, bool removeFlags) {
-#ifdef USE_FOLLY_SYMBOLIZER
+#ifdef FOLLY_USE_SYMBOLIZER
   // Install the handler now, to trap errors received during startup.
   // The callbacks, if any, can be installed later
   folly::symbolizer::installFatalSignalHandler();
@@ -44,7 +41,7 @@ void init(int* argc, char*** argv, bool removeFlags) {
   auto programName = argc && argv && *argc > 0 ? (*argv)[0] : "unknown";
   google::InitGoogleLogging(programName);
 
-#ifdef USE_FOLLY_SYMBOLIZER
+#ifdef FOLLY_USE_SYMBOLIZER
   // Don't use glog's DumpStackTraceAndExit; rely on our signal handler.
   google::InstallFailureFunction(abort);
 #endif
@@ -53,7 +50,7 @@ void init(int* argc, char*** argv, bool removeFlags) {
   // things now" phase.
   folly::SingletonVault::singleton()->registrationComplete();
 
-#ifdef USE_FOLLY_SYMBOLIZER
+#ifdef FOLLY_USE_SYMBOLIZER
   // Actually install the callbacks into the handler.
   folly::symbolizer::installFatalSignalCallbacks();
 #endif