SimonKagstrom / kcov

Code coverage tool for compiled programs, Python and Bash which uses debugging information to collect and report data without special compilation options
http://simonkagstrom.github.io/kcov/
GNU General Public License v2.0
709 stars 109 forks source link

Undefined reference to curl libraries when trying to build kcov #411

Closed shailpatels closed 7 months ago

shailpatels commented 7 months ago

Hi, I tried building kcov from the latest release and also from master but both times kcov failed to build due to linker errors. I'm building on Debian 12 and the triplet is x86_64-linux-gnu. The issue might be the same https://github.com/SimonKagstrom/kcov/issues/355 ?

Here is the output of Cmake which appears to find curl installed

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Bfd: /usr/lib/x86_64-linux-gnu/libbfd.so  
-- Target architectures: x86_64
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.13") 
-- Found CURL: /usr/local/lib/cmake/CURL/CURLConfig.cmake (found version "8.4.0")  
-- Found DL: /usr/lib/x86_64-linux-gnu/libdl.a
-- Found M: /usr/lib/x86_64-linux-gnu/libm.so
-- Found Git: /usr/bin/git
-- kcov version: v41-53-gf242
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.11")  
-- Found LibElf: /usr/lib/x86_64-linux-gnu/libelf.so  
-- Found ElfUtils: /usr/lib/x86_64-linux-gnu/libdw.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/shail/Apps/source_code/kcov/build

However after running make I get the following error

[ 79%] Linking CXX executable kcov
/usr/bin/ld: CMakeFiles/kcov.dir/utils.cc.o: in function `escape_url(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/shail/Apps/source_code/kcov/src/utils.cc:536: undefined reference to `curl_easy_init'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/utils.cc:541: undefined reference to `curl_easy_escape'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/utils.cc:552: undefined reference to `curl_easy_cleanup'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/utils.cc:552: undefined reference to `curl_easy_cleanup'
/usr/bin/ld: CMakeFiles/kcov.dir/writers/coveralls-writer.cc.o: in function `CurlConnectionHandler::talk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:63: undefined reference to `curl_formadd'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:69: undefined reference to `curl_easy_setopt'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:71: undefined reference to `curl_easy_perform'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:73: undefined reference to `curl_formfree'
/usr/bin/ld: CMakeFiles/kcov.dir/writers/coveralls-writer.cc.o: in function `CurlConnectionHandler::CurlConnectionHandler()':
/home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:32: undefined reference to `curl_slist_append'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:34: undefined reference to `curl_global_init'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:36: undefined reference to `curl_easy_init'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:39: undefined reference to `curl_easy_setopt'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:40: undefined reference to `curl_easy_setopt'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:41: undefined reference to `curl_easy_setopt'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:42: undefined reference to `curl_easy_setopt'
/usr/bin/ld: /home/shail/Apps/source_code/kcov/src/writers/coveralls-writer.cc:43: undefined reference to `curl_easy_setopt'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/kcov.dir/build.make:826: src/kcov] Error 1
make[1]: *** [CMakeFiles/Makefile2:234: src/CMakeFiles/kcov.dir/all] Error 2
make: *** [Makefile:156: all] Error 2