Files
buildroot/package/snappy/0002-add-option-to-enable-rtti.patch
Bernd Kuhls 3a795fa19a package/snappy: enable rtti
Added patch to enable rtti, needed for upcoming bump of rocksdb to fix
link error:

output/per-package/rocksdb/host/bin/../lib/gcc/x86_64-buildroot-linux-
gnu/15.2.0/../../../../x86_64-buildroot-linux-gnu/bin/ld:
 librocksdb.so.10.7.5: undefined reference to `typeinfo for snappy::Sink'

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2026-05-30 15:48:42 +02:00

53 lines
1.9 KiB
Diff

From 376f14b5933e91d08ade6a503fdd657a6e01a149 Mon Sep 17 00:00:00 2001
From: Max <tchristy001@outlook.com>
Date: Wed, 24 Nov 2021 12:16:23 -0600
Subject: [PATCH] add option to enable rtti, set default to current behavior
Upstream: https://github.com/google/snappy/pull/147 (rejected)
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[rebased for 1.2.2]
---
CMakeLists.txt | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6eef485..aefd35b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_definitions(-D_HAS_EXCEPTIONS=0)
# Disable RTTI.
- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
+ if(NOT SNAPPY_ENABLE_RTTI)
+ string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
+ endif(SNAPPY_ENABLE_RTTI)
else(MSVC)
# Use -Wall for clang and gcc.
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
@@ -78,8 +80,10 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
# Disable RTTI.
- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+ if(NOT SNAPPY_ENABLE_RTTI)
+ string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+ endif(SNAPPY_ENABLE_RTTI)
endif(MSVC)
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
@@ -98,6 +102,8 @@ option(SNAPPY_REQUIRE_AVX2 "Target processors with AVX2 support." OFF)
option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
+option(SNAPPY_ENABLE_RTTI "Enable RTTI for Snappy's library" OFF)
+
include(TestBigEndian)
test_big_endian(SNAPPY_IS_BIG_ENDIAN)