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

Build-error against local check/subunit - find_path() instead of find_library() #176

Closed
ametzler opened this issue Apr 13, 2024 · 1 comment

Comments

@ametzler
Copy link

Building 2.0.8 against check/subunit in /usr/lib (-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS) fails with

cd /tmp/blah/postsrsd-2.0.8/obj-x86_64-linux-gnu/tests/unit && /usr/bin/cmake -E cmake_link_script CMakeFiles/test_netstring_executable.dir/link.txt --verbose=1
/usr/lib/ccache/cc -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/tmp/blah/postsrsd-2.0.8=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -Wl,-z,relro -Wl,-z,now -fsanitize=address,undefined CMakeFiles/test_netstring_executable.dir/test_netstring.c.o CMakeFiles/test_netstring_executable.dir/__/__/src/netstring.c.o -o test_netstring_executable  /usr/lib/x86_64-linux-gnu/libcheck_pic.a -lm /usr/lib/x86_64-linux-gnu/librt.a 
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libcheck_pic.a(check_log.o): in function `subunit_lfun':
(.text+0x606): undefined reference to `subunit_test_start'
/usr/bin/ld: (.text+0x61e): undefined reference to `subunit_test_pass'
/usr/bin/ld: (.text+0x639): undefined reference to `subunit_test_error'
/usr/bin/ld: (.text+0x651): undefined reference to `subunit_test_fail'

Afaict cmake/FindCheck.cmake has a bug:

find_path(Check_subunit_LIBRARY subunit HINTS ${PC_SUBUNIT_LIBRARY_DIRS})
...
        if(Check_subunit_LIBRARY)
            list(APPEND Check_DEPS "${Check_subunit_LIBRARY}")
        endif()

find_path(... subunit ...) will not succeed (there is no file named "subunit" in libdir) and if it did it would return the directory instead of the library. This should read

-    find_path(Check_subunit_LIBRARY subunit HINTS ${PC_SUBUNIT_LIBRARY_DIRS})
+    find_library(Check_subunit_LIBRARY subunit HINTS ${PC_SUBUNIT_LIBRARY_DIRS})
@roehling
Copy link
Owner

Thanks for the report! Fixed in d61379d

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

2 participants