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

Tests fail to link: ld: error: unable to find library -lcppunit #27

Closed
yurivict opened this issue Jul 5, 2023 · 3 comments
Closed

Tests fail to link: ld: error: unable to find library -lcppunit #27

yurivict opened this issue Jul 5, 2023 · 3 comments

Comments

@yurivict
Copy link

yurivict commented Jul 5, 2023

[100% 1/1] : && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -DNDEBUG -fstack-protector-strong CMakeFiles/c++utilities_tests.dir/tests/cppunit.cpp.o CMakeFiles/c++utilities_tests.dir/tests/conversiontests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/iotests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/chronotests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/argumentparsertests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/traitstests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/mathtests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/misctests.cpp.o -o c++utilities_tests  -Wl,-rpath,/usr/ports/devel/cpp-utilities/work/.build:/usr/local/lib  -lcppunit  libc++utilities.so.5.24.0  /usr/local/lib/libboost_iostreams.so  /usr/local/lib/libboost_regex.so && :
FAILED: c++utilities_tests 
: && /usr/local/libexec/ccache/c++ -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include  -DNDEBUG -fstack-protector-strong CMakeFiles/c++utilities_tests.dir/tests/cppunit.cpp.o CMakeFiles/c++utilities_tests.dir/tests/conversiontests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/iotests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/chronotests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/argumentparsertests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/traitstests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/mathtests.cpp.o CMakeFiles/c++utilities_tests.dir/tests/misctests.cpp.o -o c++utilities_tests  -Wl,-rpath,/usr/ports/devel/cpp-utilities/work/.build:/usr/local/lib  -lcppunit  libc++utilities.so.5.24.0  /usr/local/lib/libboost_iostreams.so  /usr/local/lib/libboost_regex.so && :
ld: error: unable to find library -lcppunit
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
*** Error code 1

It looks like pkg-config's output is ignored:

$ pkg-config --libs cppunit
-L/usr/local/lib -lcppunit 
@Martchus
Copy link
Owner

Martchus commented Jul 5, 2023

I've just been looking at the CMake code and I guess finding CppUnit needs to be improved. The lookup is also not completely unreasonable, though. So I am wondering whether the build system even used pkg-config at all in your case? If Cppunit not detected via pkg-config so the version couldn't be checked. shows up in the configuration logs then that's not the case and it had to resort to find_library. You can set CPP_UNIT_LIB and CPP_UNIT_INCLUDE_DIR to workaround this for now.

@Martchus Martchus added the bug label Jul 5, 2023
@Martchus
Copy link
Owner

Martchus commented Jul 5, 2023

I've just pushed a potential fix (5ebbd0e) so you might try building the latest commit on GitHub.

@stale
Copy link

stale bot commented Sep 3, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 3, 2023
@stale stale bot closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants