Commit 8d0d6318 authored by Wez Furlong's avatar Wez Furlong Committed by Facebook Github Bot

add folly::init to libfolly for OSS build

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
parent 489524aa
...@@ -433,6 +433,7 @@ libfolly_la_SOURCES = \ ...@@ -433,6 +433,7 @@ libfolly_la_SOURCES = \
IPAddressV4.cpp \ IPAddressV4.cpp \
IPAddressV6.cpp \ IPAddressV6.cpp \
LifoSem.cpp \ LifoSem.cpp \
init/Init.cpp \
io/Compression.cpp \ io/Compression.cpp \
io/Cursor.cpp \ io/Cursor.cpp \
io/IOBuf.cpp \ io/IOBuf.cpp \
......
...@@ -19,11 +19,8 @@ ...@@ -19,11 +19,8 @@
#include <glog/logging.h> #include <glog/logging.h>
#include <folly/Singleton.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> #include <folly/experimental/symbolizer/SignalHandler.h>
#endif #endif
#include <folly/portability/GFlags.h> #include <folly/portability/GFlags.h>
...@@ -31,7 +28,7 @@ ...@@ -31,7 +28,7 @@
namespace folly { namespace folly {
void init(int* argc, char*** argv, bool removeFlags) { 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. // Install the handler now, to trap errors received during startup.
// The callbacks, if any, can be installed later // The callbacks, if any, can be installed later
folly::symbolizer::installFatalSignalHandler(); folly::symbolizer::installFatalSignalHandler();
...@@ -44,7 +41,7 @@ void init(int* argc, char*** argv, bool removeFlags) { ...@@ -44,7 +41,7 @@ void init(int* argc, char*** argv, bool removeFlags) {
auto programName = argc && argv && *argc > 0 ? (*argv)[0] : "unknown"; auto programName = argc && argv && *argc > 0 ? (*argv)[0] : "unknown";
google::InitGoogleLogging(programName); google::InitGoogleLogging(programName);
#ifdef USE_FOLLY_SYMBOLIZER #ifdef FOLLY_USE_SYMBOLIZER
// Don't use glog's DumpStackTraceAndExit; rely on our signal handler. // Don't use glog's DumpStackTraceAndExit; rely on our signal handler.
google::InstallFailureFunction(abort); google::InstallFailureFunction(abort);
#endif #endif
...@@ -53,7 +50,7 @@ void init(int* argc, char*** argv, bool removeFlags) { ...@@ -53,7 +50,7 @@ void init(int* argc, char*** argv, bool removeFlags) {
// things now" phase. // things now" phase.
folly::SingletonVault::singleton()->registrationComplete(); folly::SingletonVault::singleton()->registrationComplete();
#ifdef USE_FOLLY_SYMBOLIZER #ifdef FOLLY_USE_SYMBOLIZER
// Actually install the callbacks into the handler. // Actually install the callbacks into the handler.
folly::symbolizer::installFatalSignalCallbacks(); folly::symbolizer::installFatalSignalCallbacks();
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment