zeromq / cppzmq

Header-only C++ binding for libzmq
http://www.zeromq.org
MIT License
1.93k stars 757 forks source link

Known bug: can't build under Debian #590

Closed artiomn closed 1 year ago

artiomn commented 1 year ago
CMakeFiles/unit_tests.dir/message.cpp.o: in function `zmq::message_t::routing_id() const':
/vsts/agent/_work/2/s/third-party/cppzmq/zmq.hpp:651: undefined reference to `zmq_msg_routing_id'
/usr/bin/ld: [ 79%] Linking CXX shared library ../../../lib/libpcm.so
CMakeFiles/unit_tests.dir/message.cpp.o: in function `zmq::message_t::set_routing_id(unsigned int)':
/vsts/agent/_work/2/s/third-party/cppzmq/zmq.hpp:656: undefined reference to `zmq_msg_set_routing_id'
/usr/bin/ld: CMakeFiles/unit_tests.dir/message.cpp.o: in function `zmq::message_t::group() const':
/vsts/agent/_work/2/s/third-party/cppzmq/zmq.hpp:663: undefined reference to `zmq_msg_group'
/usr/bin/ld: CMakeFiles/unit_tests.dir/message.cpp.o: in function `zmq::message_t::set_group(char const*)':
/vsts/agent/_work/2/s/third-party/cppzmq/zmq.hpp:668: undefined reference to `zmq_msg_set_group'
/usr/bin/ld: CMakeFiles/unit_tests.dir/poller.cpp.o: in function `zmq::poller_t<zmq::no_user_data>::poller_t()':
/vsts/agent/_work/2/s/third-party/cppzmq/zmq.hpp:2625: undefined reference to `zmq_poller_new'
...
bla-bla-bla

I build my project in the Docker container (on CI), based on the standard gcc-12 image with some additional dependencies. CppZMQ as a package doesn't exist in this version of Debian, ZeroMQ in the package libzmq3-dev was built without ENABLE_DRAFTS option.

And in the CppZMQ build I can't set this option, because one of the developers of CppZMQ implemented a "brilliant" idea: remove this option and check for the existence of the .git directory in the CMakeLists.txt.

Ok, I've made dirty hack in my CI: remove .git directory before the submodule configuration with add_subdirectory(). But something was going wrong and I had errors again.

I like CppZMQ interface, but I can't build this library on the server CI. What I can do to fix this, except sending this library to the trash and using some alternative?

gummif commented 1 year ago

You should be able to override it. Can you try this command before adding subdirectory: set(ENABLE_DRAFTS OFF CACHE BOOL "" FORCE)

artiomn commented 1 year ago

You're right. If forgot, that I can do this via CMake cache... But now I'm using ZMQ native C++ interface.