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

Document test dependencies #4

Open
let4be opened this issue Jun 5, 2021 · 3 comments
Open

Document test dependencies #4

let4be opened this issue Jun 5, 2021 · 3 comments

Comments

@let4be
Copy link

let4be commented Jun 5, 2021

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

@let4be
Copy link
Author

let4be commented Jun 6, 2021

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 ..

@let4be
Copy link
Author

let4be commented Jun 6, 2021

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

@let4be
Copy link
Author

let4be commented Jun 6, 2021

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

target_link_libraries(robots-test absl::base absl::container absl::strings gtest_main)

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant