Document test dependencies
While following README.md and trying to build && run official google tests
I get this error
/usr/bin/ld: cannot find -labsl::container collect2: error: ld returned 1 exit status
on make stage
What should I install in order to fix this and run tests?
uname -a
5.8.0-53-generic #60-Ubuntu SMP Thu May 6 07:46:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Hm... on another try it gives me this
-- Found Python: /usr/bin/python3.8 (found version "3.8.6") found components: Interpreter
-- Configuring done
CMake Error at CMakeLists.txt:62 (add_executable):
Target "robots-test" links to target "absl::container" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
during cmake ..
found this in CMakeLists.txt.in
ExternalProject_Add(abseilcpp
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
GIT_TAG master
GIT_PROGRESS 1
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
it's never a good idea to link to master branch of a git, should always pin version of your dependencies
same goes for https://github.com/google/googletest.git
changing https://github.com/Folyd/robotstxt/blob/d46c028d63f15c52ec5ebd321db7782b7c033e81/tests/CMakeLists.txt.in
ExternalProject_Add(abseilcpp
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
GIT_TAG 20200923.2
GIT_PROGRESS 1
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/abseil-cpp-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
GIT_PROGRESS 1
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/gtest-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libs/gtest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
changing https://github.com/Folyd/robotstxt/blob/d46c028d63f15c52ec5ebd321db7782b7c033e81/tests/CMakeLists.txt#L63
to target_link_libraries(robots-test absl::base absl::container absl::strings gtest_main dl)
and then building with LDFLAGS="-Wl,--no-as-needed" cmake ..
fixed an issue!