-
Notifications
You must be signed in to change notification settings - Fork 15
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
Should we define ZMQ_HAVE_STRLCPY
for Linux?
#28
Comments
Yeah the current build system is convenient since we understand it and doesn't have a CMAKE dependency, but it for sure doesn't come close to replicating the original CMAKE build, mostly because of its massive complexity (~2k lines of code). Moreover we don't have an easy way to test for all the possible targets to find bugs such as the one you provided. There's really only two scenarios in my view. We either stick with our makeshift recreation of the cmake build and we fix it bit by bit as users file issues, or we revert back to using the cmake build. The first approach doesn't sound very good but so far we haven't that many issues. The second approach is a breaking change and is mildly inconvenient to the user, but as the advantage of not needing to maintain the build (although i think we had issues with cmake before). I'm kind of on the fence currently. |
The link you provided seems to refer to this macro which sounds kind of a pain to implement. https://github.com/zeromq/libzmq/blob/ec013f3a17beaa475c18e8cf5e93970800e2f94a/CMakeLists.txt#L255 From my understanding CMAKE implements this macro by trying to compile while linking explicitly to the symbol its trying to check to see if its available. Sounds like a pain, and very inneficient. Checking for glibc seems like less work, but potentially more error-prone as you mentionned. |
@jean-airoldie I didn't mean to bring you to ideas 😉 - we dearly need this (the removal of The macro is indeed quite simple and "the standard" in C/C++ land... I'm sure we can reproduce that quite easily with |
I'm just explaining the available solutions so you understand the situation, since you didn't seem too happy with the current quality of the build, which is understandable. The thing is, the original CMAKE build is a monster.
I just don't like the idea of trying to compile something, if it fail, set some flag. That doesn't sound like a sane solution at all, even though that's what the original did. |
@jean-airoldie forgot to mention I contributed to the removal of I'm pretty sure this is what the typical This also makes me re-realize and appreciate (my daily use of) Rust ever so slightly more, where such definition problems are pretty much not even a thing 😬 |
Glibc 2.38 just released, and one of its major new features is a definition for
strlcpy
:https://sourceware.org/pipermail/libc-alpha/2023-July/150524.html
Since we don't turn on
ZMQ_HAVE_STRLCPY
yetcompat.hpp
includes#include <string.h>
, ZMQ defines its own fallback implementation which isn't compatible with the declaration given byglibc
:One of the obvious downsides of moving away from
cmake
"recently" is that thecmake
scripts maintained by ZMQ developers have specific and intentional checks for existence of these symbols to know if they should otherwise emit a fallback implementation as the above:https://github.com/zeromq/libzmq/blob/ec013f3a17beaa475c18e8cf5e93970800e2f94a/CMakeLists.txt#L255
It seems we've just wishy-washy defined some of these while knowing barely anything about the target system, and I don't want to break anyone still on Glibc <= 2.37 so we should likely reimplement that compile-testing macro in Rust (or check for glibc version, but that seems more work / error-prone).
The text was updated successfully, but these errors were encountered: