Skip to content

Commit

Permalink
build: fix unit tests build with lrt
Browse files Browse the repository at this point in the history
After the commit 77fa45b
the unit tests builds failed like:

/opt/rh/devtoolset-6/root/usr/libexec/gcc/x86_64-redhat-linux/6.3.1/ld:
  ../../src/lib/core/libcore.a(fiber.c.o): undefined reference to symbol
  'clock_gettime@@GLIBC_2.2.5'
//lib64/librt.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
test/unit/CMakeFiles/cbus.test.dir/build.make:108: recipe for target
  'test/unit/cbus.test' failed
make[2]: *** [test/unit/cbus.test] Error 1

To fix it the rt library needed to be added like for unit tests builds.
Added -lrt to 25 builds from overall 60 at cmake file.

Close #4639
  • Loading branch information
avtikhon committed Nov 22, 2019
1 parent 2afbe26 commit f91540b
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions test/unit/CMakeLists.txt
Expand Up @@ -66,40 +66,40 @@ target_link_libraries(bloom.test salad)
add_executable(vclock.test vclock.cc)
target_link_libraries(vclock.test vclock unit)
add_executable(xrow.test xrow.cc)
target_link_libraries(xrow.test xrow unit)
target_link_libraries(xrow.test xrow unit rt)
add_executable(decimal.test decimal.c)
target_link_libraries(decimal.test core unit)

add_executable(fiber.test fiber.cc)
set_source_files_properties(fiber.cc PROPERTIES COMPILE_FLAGS -O0)
target_link_libraries(fiber.test core unit)
target_link_libraries(fiber.test core unit rt)

if (NOT ENABLE_GCOV)
# This test is known to be broken with GCOV
add_executable(guard.test guard.cc)
target_link_libraries(guard.test core unit)
target_link_libraries(guard.test core unit rt)
endif ()

add_executable(fiber_stress.test fiber_stress.cc)
target_link_libraries(fiber_stress.test core)
target_link_libraries(fiber_stress.test core rt)

add_executable(fiber_cond.test fiber_cond.c unit.c)
target_link_libraries(fiber_cond.test core)
target_link_libraries(fiber_cond.test core rt)

add_executable(fiber_channel.test fiber_channel.cc unit.c)
target_link_libraries(fiber_channel.test core)
target_link_libraries(fiber_channel.test core rt)

add_executable(fiber_channel_stress.test fiber_channel_stress.cc)
target_link_libraries(fiber_channel_stress.test core)
target_link_libraries(fiber_channel_stress.test core rt)

add_executable(cbus_stress.test cbus_stress.c)
target_link_libraries(cbus_stress.test core stat)
target_link_libraries(cbus_stress.test core stat rt)

add_executable(cbus.test cbus.c)
target_link_libraries(cbus.test core unit stat)
target_link_libraries(cbus.test core unit stat rt)

add_executable(coio.test coio.cc)
target_link_libraries(coio.test core eio bit uri unit)
target_link_libraries(coio.test core eio bit uri unit rt)

if (ENABLE_BUNDLED_MSGPUCK)
set(MSGPUCK_DIR ${PROJECT_SOURCE_DIR}/src/lib/msgpuck/)
Expand All @@ -116,7 +116,7 @@ if (ENABLE_BUNDLED_MSGPUCK)
endif ()

add_executable(scramble.test scramble.c)
target_link_libraries(scramble.test scramble)
target_link_libraries(scramble.test scramble rt)

add_executable(guava.test guava.c)
target_link_libraries(guava.test salad small)
Expand All @@ -136,7 +136,7 @@ add_executable(json.test json.c)
target_link_libraries(json.test json unit ${ICU_LIBRARIES})

add_executable(rmean.test rmean.cc)
target_link_libraries(rmean.test stat unit)
target_link_libraries(rmean.test stat unit rt)
add_executable(histogram.test histogram.c)
target_link_libraries(histogram.test stat unit)
add_executable(ratelimit.test ratelimit.c)
Expand All @@ -151,7 +151,7 @@ target_link_libraries(luaL_iterator.test unit server coll core misc
${ICU_LIBRARIES} ${LUAJIT_LIBRARIES} dl)

add_executable(say.test say.c)
target_link_libraries(say.test core unit)
target_link_libraries(say.test core unit rt)

set(ITERATOR_TEST_SOURCES
vy_iterators_helper.c
Expand All @@ -163,7 +163,7 @@ set(ITERATOR_TEST_SOURCES
set(ITERATOR_TEST_LIBS core tuple xrow unit)

add_executable(vy_mem.test vy_mem.c ${ITERATOR_TEST_SOURCES})
target_link_libraries(vy_mem.test ${ITERATOR_TEST_LIBS} dl)
target_link_libraries(vy_mem.test ${ITERATOR_TEST_LIBS} dl rt)

add_executable(vy_point_lookup.test
vy_point_lookup.c
Expand All @@ -185,11 +185,11 @@ add_executable(vy_point_lookup.test
${PROJECT_SOURCE_DIR}/src/box/schema_def.c
${PROJECT_SOURCE_DIR}/src/box/identifier.c
)
target_link_libraries(vy_point_lookup.test core tuple xrow xlog unit dl)
target_link_libraries(vy_point_lookup.test core tuple xrow xlog unit dl rt)

add_executable(column_mask.test
column_mask.c)
target_link_libraries(column_mask.test tuple unit)
target_link_libraries(column_mask.test tuple unit rt)

add_executable(vy_write_iterator.test
vy_write_iterator.c
Expand All @@ -198,16 +198,16 @@ add_executable(vy_write_iterator.test
${PROJECT_SOURCE_DIR}/src/box/vy_write_iterator.c
${ITERATOR_TEST_SOURCES}
)
target_link_libraries(vy_write_iterator.test xlog ${ITERATOR_TEST_LIBS} dl)
target_link_libraries(vy_write_iterator.test xlog ${ITERATOR_TEST_LIBS} dl rt)

add_executable(vy_cache.test vy_cache.c ${ITERATOR_TEST_SOURCES})
target_link_libraries(vy_cache.test ${ITERATOR_TEST_LIBS} dl)
target_link_libraries(vy_cache.test ${ITERATOR_TEST_LIBS} dl rt)

add_executable(coll.test coll.cpp)
target_link_libraries(coll.test coll unit misc dl)
target_link_libraries(coll.test coll unit misc dl rt)

add_executable(tuple_bigref.test tuple_bigref.c)
target_link_libraries(tuple_bigref.test tuple unit)
target_link_libraries(tuple_bigref.test tuple unit rt)

add_executable(checkpoint_schedule.test
checkpoint_schedule.c
Expand All @@ -216,23 +216,23 @@ add_executable(checkpoint_schedule.test
target_link_libraries(checkpoint_schedule.test m unit)

add_executable(sio.test sio.c)
target_link_libraries(sio.test unit core)
target_link_libraries(sio.test unit core rt)

add_executable(crypto.test crypto.c)
target_link_libraries(crypto.test crypto unit)
target_link_libraries(crypto.test crypto unit rt)

add_executable(swim.test swim.c swim_test_transport.c swim_test_ev.c
swim_test_utils.c ${PROJECT_SOURCE_DIR}/src/version.c)
target_link_libraries(swim.test unit swim)
target_link_libraries(swim.test unit swim rt)

add_executable(swim_proto.test swim_proto.c swim_test_transport.c swim_test_ev.c
swim_test_utils.c ${PROJECT_SOURCE_DIR}/src/version.c)
target_link_libraries(swim_proto.test unit swim)
target_link_libraries(swim_proto.test unit swim rt)

add_executable(swim_errinj.test swim_errinj.c swim_test_transport.c
swim_test_ev.c swim_test_utils.c
${PROJECT_SOURCE_DIR}/src/version.c)
target_link_libraries(swim_errinj.test unit swim)
target_link_libraries(swim_errinj.test unit swim rt)

add_executable(merger.test merger.test.c)
target_link_libraries(merger.test unit core box)

0 comments on commit f91540b

Please sign in to comment.