Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to bring back symbols on backtraces on linux #7109

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,27 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(NOT APPLE)
# TODO: Core APIs should always built for internal usage. But there seems to be issues with cocoa. Enable it only for Android for now.
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
elseif(APPLE)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if (REALM_BUILD_LIB_ONLY OR REALM_NO_TESTS)
if (NOT APPLE)
# TODO: Core APIs should always built for internal usage. But there seems to be issues with cocoa. Enable it only for Android for now.
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
elseif (APPLE)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif()
elseif (UNIX)
if (NOT APPLE)
# This enables symbols in backtraces, should be the same as -rdynamic
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.27.0")
set(CMAKE_EXECUTABLE_ENABLE_EXPORTS ON)
else()
set(CMAKE_ENABLE_EXPORTS ON)
endif()
endif()

# MEMO: -fvisibility=hidden prevents -rdynamic and symbols in backtrace_symbols
# so omit set(CMAKE_CXX_VISIBILITY_PRESET hidden)
# ...also add more details for backtraces on assertions
# set(CMAKE_VISIBILITY_INLINES_HIDDEN 0)
endif()

function(check_if_cxx_compiler_flag_supported flag out_var)
Expand Down
2 changes: 1 addition & 1 deletion src/realm/sync/noinst/client_history_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ void ClientHistory::update_from_ref_and_version(ref_type ref, version_type versi
m_arrays->init_from_ref(ref);
}
else {
REALM_ASSERT_RELEASE(m_group);
REALM_ASSERT_RELEASE_EX(m_group, ref, version);
m_arrays.emplace(m_db->get_alloc(), *m_group, ref);
}

Expand Down
10 changes: 0 additions & 10 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ endif()
target_link_libraries(CoreTests TestUtil QueryParser)
enable_stdfilesystem(CoreTests)

if(UNIX AND NOT APPLE)
# This enables symbols in backtraces
target_link_libraries(CoreTests "-rdynamic")
endif()

target_include_directories(CoreTests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")

add_bundled_test(CoreTests)
Expand Down Expand Up @@ -250,9 +245,4 @@ if(REALM_ENABLE_SYNC)
# Sync lib is included with SyncServer
target_link_libraries(SyncTests TestUtil SyncServer)
add_bundled_test(SyncTests)

if(UNIX AND NOT APPLE)
# This enables symbols in backtraces
target_link_libraries(SyncTests "-rdynamic")
endif()
endif()