This change:
1. Makes the `libzmq.pc` files generated by Autotools and CMake more
aligned.
2. Allows the `prefix` variable to be redefined if the package is
relocated.
Solution: don't use rt if not `RT_LIBRARY`
This currently causes the check to fail on macOS:
```bash
/Library/Developer/CommandLineTools/usr/bin/c++ -std=c++11 -Wno-tautological-constant-compare -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_8466b.dir/CheckSymbolExists.cxx.o -o cmTC_8466b -lrt
ld: library 'rt' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
even though `clock_gettime` is available.
Move the `clock_gettime` check up with the other librt related checks,
and don't set `CMAKE_REQUIRED_LIBRARIES` if not `RT_LIBRARY`.
solution: only use `-errwarn` on SunPro systems
For example, using Clang on Alpine, this just results in build spam, and
the option is incorrectly passed through to ld, which trys to use use it
(`-e`) as an entrypoint, i.e:
```bash
[ 28%] Building CXX object CMakeFiles/local_lat.dir/perf/local_lat.cpp.o
clang++: warning: -e rrwarn=%all: 'linker' input unused [-Wunused-command-line-argument]
[ 29%] Linking CXX executable bin/local_lat
/usr/bin/ld: warning: cannot find entry symbol rrwarn=%all; defaulting to 0000000000000cf0
[ 29%] Built target local_lat
```
The builtin SHA1 (ZMQ_USE_BUILTIN_SHA1) is only used in the websocket
engine (ws_engine.cpp), so if websockets are disabled, i.e
-DENABLE_DRAFTS=OFF, don't add sha1.c to the sources list.
On macOS, mkdtemp is in unistd.h. Fix the CMake check so that is works.
This was discovered when comparing the output of the Autotools an CMake
build systems.
ENABLE_CURVE is currently redundant with WITH_LIBSODIUM, as the only existing provider
now builds where requested configuration is not found fail rather than proceeding without requested features
On its own, -std=c11 hides POSIX and other extensions from C headers
such as <stdlib.h> when building against glibc. This causes the
posix_memalign probe to fail incorrectly with compilers that do not
accept implicit function declarations. _DEFAULT_SOURCE is ignored by
most non-GNU/Linux systems or not relevant in this context, so there
is no separate check for adding it.
* migrate from the old, unmaintained "asciidoc-py" tool to the new "asciidoctor" generator
* migrate from asciidoc-py syntax to the modern Asciidoc syntax (especially page titles and section titles)
* remove the need of "xmlto" utility to create the manpage output; use asciidoctor for that
* add HTML output support to the doc/Makefile by using asciidoctor
* change API documentation files extension from .txt to .adoc to make it more explicit that they are Asciidoc-encoded (as a bonus several IDE plugins will autodetect the .adoc format as Asciidoc)
* remove asciidoc.conf: asciidoctor does not support that; this also required replacing the macro linkzmq into all documentation pages
* add a new Github action CI do deploy to Github Pages the static HTMLs produced by Asciidoctors
* removed references to the "xmlto" and "a2x" tools from the build and packaging systems: Asciidoctor can convert the documentation directly to e.g. pdf (via extended converters) and anyway there was no code/target for using "xmlto" and "a2x" tools anyway
Solution: remove implementation. Frank Hartmann <soundart@gmx.net>,
the author, rejected our request to relicense under MPL2, so we
have to remove his copyrighted work.
Tweetnacl is not security-supported and could not be used in
production environments anyway, the supported backend is libsodium.
The pkg_config_defines variable was only set in configure.ac, but not in
CMake. This lead to the `-DZMQ_BUILD_DRAFT_API=1` flag to be omitted
from the generated pkg-config file.
Signed-off-by: Nicolas Benes <nbenes.gh@xandea.de>
* Problem: In rare cases, afunix.h doesn't contain a definition for struct sockaddr_un
According to https://github.com/microsoft/vcpkg/issues/21623,
struct sockaddr_un might be unavailable on some machines even afunix.h exists.
For example, on some machines, the content of afunix.h looks like this:
typedef struct _SOCKADDR_UN
{
ADDRESS_FAMILY Family;
wchar_t Path[63];
} SOCKADDR_UN, *PSOCKADDR_UN;
but on other machines, it may looks like this:
#define UNIX_PATH_MAX 108
typedef struct sockaddr_un
{
ADDRESS_FAMILY sun_family;
char sun_path[UNIX_PATH_MAX];
} SOCKADDR_UN, *PSOCKADDR_UN;
Fixes#3949
References:
- [Enable Unix-domain sockets support on Windows](8f3ec75de4)
- [AF_UNIX equivalent for Windows](https://stackoverflow.com/questions/9029174/af-unix-equivalent-for-windows)
- https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
Solution: add a preprocessor variable ZMQ_NO_EXPORT that, when set, bypasses the automatic ZMQ_EXPORT determination block and just sets ZMQ_EXPORT to empty.
By combining this solution at configuration time with manually passing -fvisibility=hidden to CXXFLAGS, I solved my visibility problem. Just passing -fvisibility=hidden is not enough, because __attribute__ ((visibility ("default"))) has higher priority.
zmq_ppoll mostly mimics zmq_poll behavior, except for the added feature of being able to specify a signal mask. Signals in this mask will be blocked during execution of zmq_ppoll. Switching of the process' active signal mask happens atomically with the actual poll call, so that no race conditions can occur. This behavior is useful when one wants to gracefully handle POSIX signals without race conditions. See e.g. the discussion below https://250bpm.com/blog:12/ for an explanation.
Also includes two new tests:
1. test_zmq_ppoll_fd does the same thing as test_zmq_poll_fd, demonstrating backwards compatibility with zmq_poll when used with a default signal mask.
2. test_zmq_ppoll_signals demonstrates the use of zmq_ppoll with a signal mask, blocking out SIGTERM everywhere except in zmq_ppoll, allowing to handle the signal in one place without having to worry about race conditions.
* add opt-out for randombytes_close
Problem: randombytes_close is either a no-op or unsafe when a Context is running.
Unfortunately, there does not appear to be a single always correct choice,
so let builders pick between two not-great options.
Opting out can leak an FD on /dev/urandom which may need to be closed explicitly.
However, with the default behavior,
using multiple contexts with CURVE can crash with no application-level workaround available.
randombytes_close is not threadsafe and calling it while still in use by a Context can cause a crash.
For implementations using /dev/[u]random, this can leave up to one leftover FD per process.
The libsodium docs suggest that this function rarely needs to be called explicitly.
If you cloned and built this repo or built it from a submodule, it
would always report "Build and install draft classes and methods"
which first might be wrong if ENABLE_DRAFTS is OFF but also didn't
match the tense of other similar messages about build options.
Retain GNU extensions for C99 and C++98 since testing old compilers
is especially difficult and these compilation modes exist to maintain
compatability.
* Problem: No direct support for setting socket priority
Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
Don't include bsd/string.h if strlcpy is also defined in string.h to
avoid the following build failure on uclibc:
In file included from src/compat.hpp:41:0,
from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bsd/string.h:44:54: error: declaration of 'size_t strlcpy(char*, const char*, size_t)' has a different exception specifier
size_t strlcpy(char *dst, const char *src, size_t siz);
^
In file included from src/compat.hpp:34:0,
from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/string.h:424:15: error: from previous declaration 'size_t strlcpy(char*, const char*, size_t) throw ()'
extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
^
Fixes:
- http://autobuild.buildroot.org/results/51220b1b82774e8f6f6ed8593c58d2e3c31a1531
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* apply the use of sources for xcode project also to dynamic library
Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
Co-authored-by: stephane vales <vales@ingenuity.io>
* use sources instead of objects only when generating an xcode project
Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
Co-authored-by: stephane vales <vales@ingenuity.io>