Skip to content

We should link Protobuf release or debug libraries as appropriate to CMake build type #57

Description

@adamnovak

We always link the main Protobuf libraries.

libvgio/CMakeLists.txt

Lines 26 to 27 in eb1fe76

string(REGEX REPLACE "(\\.so|\\.dylib)$" ".a" Protobuf_STATIC_LIBRARIES "${Protobuf_LIBRARIES}")
message("Protobuf will be ${Protobuf_LIBRARIES} for PIC dynamic code and ${Protobuf_STATIC_LIBRARIES} for non-PIC static code")

FindProtobuf will find us debug versions of the Protobuf libraries, and they can be meaningfully different. We ought to pick the one to link based on whether the CMake build type is a debug one or not, so we can't end up with missing symbols, and so we don't cheat the one-definition rule and get (almost certainly benign) undefined behavior from the linker.

This would probably want to propagate up to vg and how its build process finds Protobuf to link against. We would also potentially have trouble if systems don't actually package a debug-mode Protobuf library. Also, the debug-mode Protobuf library is probably a lot slower, so it might be too slow for us to use, and we might not have a good solution other than trying to use the release library with an asserts-enabled vg application.

(An alternative would be to #define NDEBUG around all the Protobuf header includes in all the projects.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions