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

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

Open
adamnovak opened this issue Jul 22, 2022 · 0 comments

Comments

@adamnovak
Copy link
Member

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.)

@adamnovak adamnovak changed the title We should like Protobuf release or debug libraries as appropriate to CMake build type We should link Protobuf release or debug libraries as appropriate to CMake build type Jul 22, 2022
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

1 participant