Skip to content

Commit 908144a

Browse files
afrindmeta-codesync[bot]
authored andcommitted
fbcode_builder: force snappy to build with RTTI
Summary: X-link: facebook/mvfst#459 folly's `Compression.cpp` `dynamic_cast`s `snappy::Source` / `snappy::Sink`, which requires their typeinfo symbols. The snappy revision pinned in our manifest (`27ab5f7f...`) hardcodes `-fno-rtti` in `CMAKE_CXX_FLAGS` and even strips any `-frtti` we try to inject, so `libsnappy.so` ships without typeinfo for those polymorphic bases. Any downstream that actually pulls in folly's Snappy codec (proxygen, mvfst, folly's own `compression_compression_test` which is gated behind `BUILD_SLOW_TESTS`) fails to link with: undefined reference to `typeinfo for snappy::Source' Override via `CMAKE_CXX_FLAGS_<CONFIG>`, which CMake appends after `CMAKE_CXX_FLAGS` and snappy doesn't touch — the trailing `-frtti` wins over the earlier `-fno-rtti` in gcc. Reviewed By: jbeshay Differential Revision: D106941114 fbshipit-source-id: e38101d546f42a2ef392e6fc80d7967efb5a72a2
1 parent e004b28 commit 908144a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • build/fbcode_builder/manifests

build/fbcode_builder/manifests/snappy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ subdir = snappy-27ab5f7f518430a021239bc26a5b2fd64affbc7b
2424
[cmake.defines]
2525
SNAPPY_BUILD_TESTS = OFF
2626
SNAPPY_BUILD_BENCHMARKS = OFF
27+
# folly's Compression.cpp dynamic_casts snappy::Source/Sink and needs their
28+
# typeinfo. Snappy hardcodes -fno-rtti in CMAKE_CXX_FLAGS; override via the
29+
# per-config flags variable, which is appended after (last -f wins in gcc).
30+
CMAKE_CXX_FLAGS_RELWITHDEBINFO = -O2 -g -DNDEBUG -frtti
31+
CMAKE_CXX_FLAGS_RELEASE = -O3 -DNDEBUG -frtti
32+
CMAKE_CXX_FLAGS_DEBUG = -g -frtti
2733

2834
# Avoid problems like `relocation R_X86_64_PC32 against symbol` on ELF systems
2935
# when linking rocksdb, which builds PIC even when building a static lib

0 commit comments

Comments
 (0)