google / bloaty

Bloaty: a size profiler for binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libbloaty target not installed

richmattes opened this issue · comments

The libbloaty library target is not installed in CMakeLists.txt. This makes it impossible to link against a system installed libbloaty (e.g. installed with make install) in either static or dynamic library configuration (BUILD_SHARED_LIBS=OFF,ON)

Additionally, ${CMAKE_INSTALL_PREFIX}/bin/bloaty won't work when linked against a dynamic libbloaty, as it won't be able to find the library on the default search path.

I recommend adding libbloaty to the list of TARGETS when calling the install command, or forcing it to be a static library when calling add_library if it's not meant to be linked to externally.

Thanks for the feedback. I want to force a static link, as libbloaty is not a public library.

I'm a CMake novice, and I thought I was using a static link already. How are you invoking CMake such that libbloaty is getting linked dynamically?

I think #200 is the right fix for this? Let me know if that won't be sufficient.

Yup that should do it. Fedora's default CMake arguments for packaging set the -DBUILD_SHARED_LIBS=ON flag, which is how I got into the situation where it was trying to build libbloaty as a shared library.

Cool, thanks for the feedback. By the way, do you need this included in a release to package it in Fedora? I could cut a 1.1.1 if that would help.

I think it can wait until your next normal release - it's easy enough to override the flag in the near term, especially now that I know it's intended to be statically linked. Fedora sets the flag that way to avoid accidentally installing static libraries vs. shared libraries, which isn't what's happening here.

https://bugzilla.redhat.com/show_bug.cgi?id=1839555