Summary:
When trying to build with targets files on OSX, I couldn't use the symbolizer because it needs StackTrace, which requires libunwind and elf. This makes it so that we only build on linux for now. This also makes it so that we set FOLLY_USE_SYMBOLIZER in autoconf, since that wasn't set before.
Does a few things surrounding usage of the symbolizer library:
- Introduce FOLLY_USE_SYMBOLIZER in folly-config.h and USE_SYMBOLIZER as an AM definition
-- Filter some code out of init and some other random libs that optionally need the symbolizer
- Fix libdwarf detection. Previously on a fresh ubuntu container, we didn't find libdwarf/dwarf.h, so we stopped trying before looking at dwarf.h
Reviewed By: yfeldblum
Differential Revision:
D5644352
fbshipit-source-id:
f0a3580c41122e5e8fdfd17a9fdbb0921be21401
experimental/observer/SimpleObservable-inl.h \
experimental/ProgramOptions.h \
experimental/ReadMostlySharedPtr.h \
- experimental/symbolizer/Elf.h \
- experimental/symbolizer/Elf-inl.h \
- experimental/symbolizer/ElfCache.h \
- experimental/symbolizer/Dwarf.h \
- experimental/symbolizer/LineReader.h \
- experimental/symbolizer/SignalHandler.h \
- experimental/symbolizer/StackTrace.h \
- experimental/symbolizer/Symbolizer.h \
experimental/Select64.h \
experimental/StampedPtr.h \
experimental/StringKeyedCommon.h \
fibers/TimeoutController.cpp
endif
+if USE_SYMBOLIZER
+nobase_follyinclude_HEADERS += \
+ experimental/symbolizer/Elf.h \
+ experimental/symbolizer/Elf-inl.h \
+ experimental/symbolizer/ElfCache.h \
+ experimental/symbolizer/Dwarf.h \
+ experimental/symbolizer/LineReader.h \
+ experimental/symbolizer/SignalHandler.h \
+ experimental/symbolizer/StackTrace.h \
+ experimental/symbolizer/Symbolizer.h
+
+libfolly_la_SOURCES += \
+ experimental/symbolizer/Elf.cpp \
+ experimental/symbolizer/ElfCache.cpp \
+ experimental/symbolizer/Dwarf.cpp \
+ experimental/symbolizer/LineReader.cpp \
+ experimental/symbolizer/SignalHandler.cpp \
+ experimental/symbolizer/StackTrace.cpp \
+ experimental/symbolizer/Symbolizer.cpp
+endif
+
libfollybasesse42_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LT_VERSION)
libfollybasesse42_la_CXXFLAGS = -msse4.2 -mpclmul
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#include <folly/portability/Config.h>
+
+#ifdef FOLLY_USE_SYMBOLIZER
#include <folly/Singleton.h>
-#include <folly/experimental/symbolizer/Symbolizer.h>
+#include <folly/experimental/symbolizer/Symbolizer.h> // @manual
namespace folly {
SetStackTraceGetter __attribute__((__init_priority__(101))) setStackTraceGetter;
#endif
}
-
}
+#endif
[use_follytestmain=${enableval}], [use_follytestmain=yes])
# libdwarf used to install in /usr/include, now installs in /usr/include/libdwarf.
-AC_CHECK_HEADERS([libdwarf/dwarf.h dwarf.h], [break])
-# Check whether we have both the library and the header
have_libdwarf=no
-AS_IF([test "x${ac_cv_header_libdwarf_dwarf_h}" = xyes], [have_libdwarf=yes])
-AS_IF([test "x${ac_cv_header_dwarf_h}" = xyes], [have_libdwarf=yes])
-
+AC_CHECK_HEADERS([libdwarf/dwarf.h dwarf.h], [have_libdwarf=yes])
AC_ARG_ENABLE([mobile],
AS_HELP_STRING([--enable-mobile],
AS_HELP_STRING([--enable-exception-tracer], [enables building exception tracer]),
[build_exception_tracer=${enableval}], [build_exception_tracer=no])
+AC_ARG_ENABLE([symbolizer],
+ AS_HELP_STRING([--enable-symbolizer], [try to build symbolizer if possible]),
+ [folly_try_use_symbolizer=${enableval}], [folly_try_use_symbolizer=yes])
+
+folly_use_symbolizer=no
+if test "$folly_try_use_symbolizer" = yes; then
+ if test "$build_os" = "linux-gnu" && test "$have_libdwarf" = yes; then
+ AC_CHECK_HEADER(
+ [elf.h],
+ AC_CHECK_LIB([unwind], [backtrace], [folly_use_symbolizer=yes]),
+ )
+ fi
+fi
+if test "$folly_use_symbolizer" = yes; then
+ AC_DEFINE([USE_SYMBOLIZER], [1], [Define to 1 if we should use the symbolizer in init])
+fi
+
+
# Include directory that contains "folly" so #include <folly/Foo.h> works
AM_CPPFLAGS='-I$(top_srcdir)/..'
AM_CPPFLAGS="$AM_CPPFLAGS $BOOST_CPPFLAGS $OPENSSL_INCLUDES"
AM_CONDITIONAL([HAVE_LIBDWARF], [test "x${have_libdwarf}" = "xyes"])
AM_CONDITIONAL([HAVE_BOOST_CONTEXT], [test "x${ax_cv_boost_context}" = "xyes"])
AM_CONDITIONAL([EXCEPTION_TRACER], [test "x${build_exception_tracer}" = "xyes"])
+AM_CONDITIONAL([USE_SYMBOLIZER], [test "x${folly_use_symbolizer}" = "xyes"])
# remove pkg-config deps from dependent libraries
# (at least for pkg-config file purposes)
-if HAVE_LIBDWARF
+if USE_SYMBOLIZER
MAYBE_SYMBOLIZER = symbolizer
endif
if EXCEPTION_TRACER
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <folly/experimental/symbolizer/SignalHandler.h>
+
#include <folly/fibers/FiberManagerMap.h>
#include <folly/init/Init.h>
#include <glog/logging.h>
#include <folly/Singleton.h>
+#include <folly/portability/Config.h>
#ifdef FOLLY_USE_SYMBOLIZER
-#include <folly/experimental/symbolizer/SignalHandler.h>
+#include <folly/experimental/symbolizer/SignalHandler.h> // @manual
#endif
#include <folly/portability/GFlags.h>
lib_LTLIBRARIES = libfollyinit.la
-if HAVE_LIBDWARF
-FOLLY_SYMBOLIZER=$(top_builddir)/experimental/symbolizer/libfollysymbolizer.la
-endif
-
libfollyinit_la_SOURCES = Init.cpp
-libfollyinit_la_LIBADD = $(top_builddir)/libfolly.la $(FOLLY_SYMBOLIZER)
+libfollyinit_la_LIBADD = $(top_builddir)/libfolly.la
libfollyinit_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LT_VERSION)