Skip to content

Commit

Permalink
build(macos/other): librt is not needed
Browse files Browse the repository at this point in the history
Since glibc >=2.17 (2012-12-25), librt is a stub-only library.
(https://abi-laboratory.pro/?view=changelog&l=glibc&v=2.17)

* The `clock_*' suite of functions (declared in <time.h>) is now available
  directly in the main C library.  Previously it was necessary to link with
  -lrt to use these functions.  This change has the effect that a
  single-threaded program that uses a function such as `clock_gettime' (and
  is not linked with -lrt) will no longer implicitly load the pthreads
  library at runtime and so will not suffer the overheads associated with
  multi-thread support in other code such as the C++ runtime library.

Current version on Arch Linux is 2.40.

Signed-off-by: Ivan Prisyazhnyy <john.koepi@gmail.com>
  • Loading branch information
sitano committed Aug 25, 2024
1 parent 5db72da commit 6d92b2a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
10 changes: 0 additions & 10 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,6 @@ if not conf.CheckLib('pthread'):
if not x86:
conf.CheckLib('atomic')

if sysname != 'darwin':
if not conf.CheckLib('rt'):
print('Error: rt library not found')
Exit(1)

if sysname == 'freebsd':
if not conf.CheckLib('execinfo'):
print('Error: execinfo library not found')
Expand Down Expand Up @@ -775,11 +770,6 @@ if not conf.CheckLib('m'):
# potential check dependency, link if present
conf.CheckLib('subunit')

if sysname != 'darwin':
if not conf.CheckLib('rt'):
print('Error: realtime library not found or not usable')
Exit(1)

if not conf.CheckCXXHeader('boost/filesystem.hpp'):
print('Error: boost/filesystem.hpp file not found or not usable')
Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions cmake/os.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#

find_library(PTHREAD_LIB pthread)
find_library(RT_LIB rt)
set(GALERA_SYSTEM_LIBS ${PTHREAD_LIB} ${RT_LIB})

set(GALERA_SYSTEM_LIBS ${PTHREAD_LIB})

if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# Check if linkage with atomic library is needed for 8 byte atomics
Expand Down
2 changes: 1 addition & 1 deletion galerautils/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ target_compile_options(deqmap_bench
PRIVATE
-Wno-conversion)

target_link_libraries(deqmap_bench galerautilsxx rt)
target_link_libraries(deqmap_bench galerautilsxx)

#
# CRC32C micro benchmark.
Expand Down
2 changes: 1 addition & 1 deletion gcache/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ target_link_libraries(gcache galerautilsxx)

add_executable(gcache_test test.cpp)

target_link_libraries(gcache_test gcache pthread rt)
target_link_libraries(gcache_test gcache pthread)

target_compile_options(gcache_test
PRIVATE
Expand Down

0 comments on commit 6d92b2a

Please sign in to comment.