Skip to content

Fix snappy RTTI linker error in open-source CI#166

Closed
shitanshu-shah wants to merge 1 commit into
facebook:mainfrom
shitanshu-shah:export-D107163112
Closed

Fix snappy RTTI linker error in open-source CI#166
shitanshu-shah wants to merge 1 commit into
facebook:mainfrom
shitanshu-shah:export-D107163112

Conversation

@shitanshu-shah

Copy link
Copy Markdown

Summary:
Snappy >= 1.1.9 disables RTTI by default via set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") in its CMakeLists.txt (google/snappy#184). This causes undefined reference to typeinfo for snappy::Source when linking openr binaries, because folly's compression module (compiled with RTTI) references snappy's typeinfo which the RTTI-stripped libsnappy.so doesn't export.

The previous approach of passing CMAKE_CXX_FLAGS=-frtti via --extra-cmake-defines does not work because snappy's CMakeLists.txt explicitly strips any existing -frtti before appending -fno-rtti.

Fix: add a workflow step after fetching snappy that patches its CMakeLists.txt to remove -fno-rtti, restoring the GCC default (RTTI enabled). This is the same approach used by Fedora, Debian, and openSUSE to work around google/snappy#184.

Reviewed By: mloo3

Differential Revision: D107163112

Summary:
Snappy >= 1.1.9 disables RTTI by default via `set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")` in its CMakeLists.txt (google/snappy#184). This causes `undefined reference to typeinfo for snappy::Source` when linking openr binaries, because folly's compression module (compiled with RTTI) references snappy's typeinfo which the RTTI-stripped `libsnappy.so` doesn't export.

The previous approach of passing `CMAKE_CXX_FLAGS=-frtti` via `--extra-cmake-defines` does not work because snappy's CMakeLists.txt explicitly strips any existing `-frtti` before appending `-fno-rtti`.

Fix: add a workflow step after fetching snappy that patches its CMakeLists.txt to remove `-fno-rtti`, restoring the GCC default (RTTI enabled). This is the same approach used by Fedora, Debian, and openSUSE to work around google/snappy#184.

Reviewed By: mloo3

Differential Revision: D107163112
@meta-cla meta-cla Bot added the CLA Signed label Jun 2, 2026
@meta-codesync

meta-codesync Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@shitanshu-shah has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107163112.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant