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
720 stars 110 forks source link

make kcov available in conan package manager #321

Closed davidtazy closed 4 years ago

davidtazy commented 4 years ago

it would be nice to add this tool as a "build-requires" in a conanfile.txt

SimonKagstrom commented 4 years ago

I agree. I'm not personally knowledgeable in conan though, but perhaps someone would like to pick it up?

davidtazy commented 4 years ago

did a proof of concept https://github.com/davidtazy/conan-kcov

made 2 little patches from the original cmakelist : https://github.com/davidtazy/kcov/commits/master

@SimonKagstrom could you check them and tell if its a conan build system problem or if the kcov CmakeLists could be "enhanced" ?

if its a conan problem, the conan recipe can patch cmakelist.

SimonKagstrom commented 4 years ago

I understand the libssl fix (thanks!), but I don't quite get the SOLIB patch and has commented it in the commit.

Doesn't the conan package build work otherwise?

davidtazy commented 4 years ago

Dont know why, but ${SOLIB} is generated in ${CMAKE_BINARY_DIR}/lib, so it is not compiling unless this patch. maybe a better fix should be to use "generator expression" $<TARGET_FILE:${SOLIB}> (seem to be available in cmake 2.8.4)

FYI cmake command generated by conan is: cd '/home/***/conan-kcov/tmp/build' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="OFF" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="8" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++11" -DCMAKE_INSTALL_PREFIX="/home/***/conan-kcov/tmp/build/package" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -Wno-dev '/home/***/conan-kcov/tmp/source/kcov'

SimonKagstrom commented 4 years ago

Looks like a good solution to me!

I'll merge the pull-request when it arrives.

davidtazy commented 4 years ago

i proposed a recipe at the conan center index, https://github.com/conan-io/conan-center-index/pull/1538.

davidtazy commented 4 years ago

@SimonKagstrom , https://github.com/conan-io/conan-center-index/pull/1538#issuecomment-652613214 can you help me with this request? :What's the required library, libdw?

l3laze commented 4 years ago

The command ldd or its friends like objdump, readelf, pmap, and ldconfig (or a combination of them maybe) should be able to help.

SimonKagstrom commented 4 years ago

Sorry about the late reply, but libdw-dev (sometimes called elfutils-devel) is required. libdw is the library for reading DWARF information in ELF files.

Confusingly enough, there are multiple variants/implementations of it, but they should be in conflict with one another in the distro package managers.

davidtazy commented 4 years ago

ok, conan provide elfutils package now.

conan guys asked me if kcov can be build on windows/mingw ?

SimonKagstrom commented 4 years ago

Not out of the box, but it would be possible to build one which has only Python/Bash support. The OSX build used to do that (before the LLDB-based instrumentation for binaries), so it's basically a bit of CMake-hacking that's needed :-)

davidtazy commented 4 years ago

OK, kcov v38 is available through conan center https://conan.io/center/kcov/38/

davidtazy commented 4 years ago

minimal howto:

mkdir tmp  & cd tmp 
conan install kcov/38@ -g virtualrunenv
source ./activate_run.sh
kcov --version  
SimonKagstrom commented 4 years ago

Splendid work @davidtazy ! So I guess we can close this now?

davidtazy commented 4 years ago

Thanks,!