From be2afbff00abcd84cfef3d4d0c1632cd0e46dc71 Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Fri, 18 Sep 2026 12:16:05 +0100 Subject: [PATCH] cachebench: link binary_trace_gen against cachelib_cachebench The cachelib_binary_trace_gen library duplicates a subset of the cachelib_cachebench sources, including runner/Runner.cpp and runner/Stressor.cpp, but leaves out the runner/, consistency/ and workload/ files those two depend on. With static libraries the linker only pulls the objects binary_trace_gen.cpp actually uses, so the gap is invisible; with BUILD_SHARED_LIBS=ON the whole library becomes a shared object with 36 undefined references and linking the executable fails: ld: cachebench/libcachelib_binary_trace_gen.so: undefined reference to `facebook::cachelib::cachebench::CacheStressorBase::finish()' It would also produce a binary_trace_gen that depends on a library the install rules never install. The duplicate also misses the SKIP_OPTION_SIZE_VERIFY definition applied to cachelib_cachebench on non-x86_64. Drop the duplicate and link binary_trace_gen against cachelib_cachebench, which already contains every source it listed. Tested with getdeps --shared-lib on Fedora Rawhide aarch64 (the Fedora package build): binary_trace_gen now links and depends on libcachelib_cachebench.so.19. Co-Authored-By: Claude Fable 5.1 Signed-off-by: Michel Lind --- cachelib/cachebench/CMakeLists.txt | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/cachelib/cachebench/CMakeLists.txt b/cachelib/cachebench/CMakeLists.txt index 712c3d744e..c0b6200e8a 100644 --- a/cachelib/cachebench/CMakeLists.txt +++ b/cachelib/cachebench/CMakeLists.txt @@ -61,30 +61,6 @@ target_link_libraries(cachelib_cachebench Boost::boost ) -add_library (cachelib_binary_trace_gen - ./runner/Runner.cpp - ./runner/Stressor.cpp - ./util/CacheConfig.cpp - ./util/Config.cpp - ./util/MemoryMonitorScript.cpp - ./workload/BlockChunkCache.cpp - ./workload/BlockChunkReplayGenerator.cpp - ./workload/PieceWiseCache.cpp - ./workload/OnlineGenerator.cpp - ./workload/WorkloadGenerator.cpp - ./workload/PieceWiseReplayGenerator.cpp - ${OBJECT_CACHE_PERSISTENCE_THRIFT_FILES} - ) -add_dependencies(cachelib_binary_trace_gen thrift_generated_files) -target_link_libraries(cachelib_binary_trace_gen - PUBLIC - cachelib_datatype - cachelib_allocator - gflags - PRIVATE - Boost::boost -) - if ((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)) else() @@ -96,7 +72,7 @@ endif() add_executable (cachebench main.cpp) add_executable (binary_trace_gen binary_trace_gen.cpp) target_link_libraries(cachebench cachelib_cachebench) -target_link_libraries(binary_trace_gen cachelib_binary_trace_gen) +target_link_libraries(binary_trace_gen cachelib_cachebench) install( TARGETS