cgreen-runner: "error while loading shared libraries" after make install on Manjaro
Happy to provide more info, but pretty simple:
$ git clone https://github.com/cgreen-devs/cgreen
$ cd cgreen
$ make
$ make install
$ cgreen-runner
Output:
cgreen-runner: error while loading shared libraries: libcgreen.so.1: cannot open shared object file: No such file or directory
This is on Manjaro Linux using GCC 10.2.0.
Edit: Of course, if I run cgreen-runner using ./build/tools/cgreen-runner, there's no issue.
Without any more details I think this has to do with where Cgreens library get installed using the CMake formulas. I am suspecting that it installs in /usr/local/lib and that is not usually part of the ldconfig.
Cgreen is using the CMake "package" GNUInstallDirswhich is supposed to set install dirs correctly. But I've indications that make me suspected that it is not complete.
Could you verify my theory?
(Or maybe I have misinterpreted the function of GNUInstallDirs, I'm not sure how they are used in the CMake-files for Cgreen, actually...)
Oops, sorry, that would have been useful info to include!
Yes, you’re correct: it installs to /usr/local/lib.
Incidentally, I’ve also futzed with getting CMake to install libraries correctly for my own projects—it is not straightforward! And very difficult to tell if you’ve made a mistake...
Updating this since I'm running into the same issue using Travis. See the .travis.yml file in this branch: https://github.com/sampotter/jmm/tree/bvh/.
When I run sudo make install using that .travis.yml file, I get:
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/cmake/cgreen/cgreen-config.cmake
-- Installing: /usr/local/lib/cmake/cgreen/cgreen-config-version.cmake
-- Up-to-date: /usr/local/share//man
-- Installing: /usr/local/share//man/man5
-- Installing: /usr/local/share//man/man5/cgreen.5
-- Up-to-date: /usr/local/share//man/man1
-- Installing: /usr/local/share//man/man1/cgreen-runner.1
-- Installing: /usr/local/share//man/man1/cgreen-debug.1
-- Installing: /usr/local/include/cgreen/assertions.h
-- Installing: /usr/local/include/cgreen/boxed_double.h
-- Installing: /usr/local/include/cgreen/breadcrumb.h
-- Installing: /usr/local/include/cgreen/cdash_reporter.h
-- Installing: /usr/local/include/cgreen/cgreen.h
-- Installing: /usr/local/include/cgreen/cgreen_value.h
-- Installing: /usr/local/include/cgreen/constraint.h
-- Installing: /usr/local/include/cgreen/constraint_syntax_helpers.h
-- Installing: /usr/local/include/cgreen/cpp_assertions.h
-- Installing: /usr/local/include/cgreen/cpp_constraint.h
-- Installing: /usr/local/include/cgreen/cute_reporter.h
-- Installing: /usr/local/include/cgreen/legacy.h
-- Installing: /usr/local/include/cgreen/mocks.h
-- Installing: /usr/local/include/cgreen/string_comparison.h
-- Installing: /usr/local/include/cgreen/reporter.h
-- Installing: /usr/local/include/cgreen/runner.h
-- Installing: /usr/local/include/cgreen/suite.h
-- Installing: /usr/local/include/cgreen/text_reporter.h
-- Installing: /usr/local/include/cgreen/unit.h
-- Installing: /usr/local/include/cgreen/vector.h
-- Installing: /usr/local/include/cgreen/internal/unit_implementation.h
-- Installing: /usr/local/include/cgreen/internal/mock_table.h
-- Installing: /usr/local/include/cgreen/internal/mocks_internal.h
-- Installing: /usr/local/include/cgreen/internal/suite_internal.h
-- Installing: /usr/local/include/cgreen/internal/assertions_internal.h
-- Installing: /usr/local/include/cgreen/internal/c_assertions.h
-- Installing: /usr/local/include/cgreen/internal/cpp_assertions.h
-- Installing: /usr/local/include/cgreen/internal/cgreen_pipe.h
-- Installing: /usr/local/include/cgreen/internal/cgreen_time.h
-- Installing: /usr/local/include/cgreen/internal/runner_platform.h
-- Installing: /usr/local/include/cgreen/internal/function_macro.h
-- Installing: /usr/local/include/cgreen/internal/stringify_token.h
-- Installing: /usr/local/lib/libcgreen.so.1.3.0
-- Installing: /usr/local/lib/libcgreen.so.1
-- Installing: /usr/local/lib/libcgreen.so
-- Installing: /usr/local/bin/cgreen-runner
-- Set runtime path of "/usr/local/bin/cgreen-runner" to ""
-- Installing: /usr/local/bin/cgreen-debug
And then when actually trying to run the tests:
$ ./quick_test.sh
cd build
cgreen-runner libjmm_tests.dylib
cgreen-runner: error while loading shared libraries: libcgreen.so.1: cannot open shared object file: No such file or directory
The command "./quick_test.sh" exited with 127.
This is using my fork of cgreen, but I don't believe there have been any commits that would have fixed this issue.
One more quick comment: running sudo ldconfig manually after sudo make install does fix this problem.