lzmq icon indicating copy to clipboard operation
lzmq copied to clipboard

lzmq should use C++ linker (or ZeroMQ should stop using exceptions)

Open Elv13 opened this issue 3 years ago • 1 comments

Hello, love this library. I just want to document a problem I had when packaging it for an embedded system with (very) limited storage space. Using the $CC to link lzmq.so is that it only works if libstdc++ is a shared library. If it's a static library, then -lstdc++ gets ignored by GCC and the throw and new symbols are not linked at all. For some dubious reasons, it actually still produce a binary, but it doesn't work (undefined symbols at runtime).

Please either add this to CMakeLists.txt:

set_target_properties(lzmq PROPERTIES LINKER_LANGUAGE CXX)

Maybe wrapped in an CMAKE_CXX_COMPILER_ID check if you want to preserve the ability to compile on system without a C++ compiler, but which a shared libstdc++ library.

Or stop using C++ exception (and that's better). Then it's really only C symbols and wont depend on libstdc++ at all. C++ exceptions are banned in a lot of projects for various reasons, this is one of them.

Elv13 avatar Sep 26 '22 00:09 Elv13

This library does not use any C++ exceptions. May be you link with static Lua compiled with them ?

moteus avatar Dec 10 '22 07:12 moteus