0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 23:01:04 +08:00

201 Commits

Author SHA1 Message Date
Hennadii Stepanov
45b2924a0a Fix Autotools-generated libzmq.pc file
This change fixes cross-compiling for Windows with static linking.
2024-03-21 12:22:43 +00:00
Eli Schwartz
3b264019a2 configure: fix basic syntax errors in the shell script programming language
There is no such thing as `+=` unless you happen to be using the Bash
programming language, i.e. your script shebang is /bin/bash.

However, configure scripts are run via /bin/sh instead, which may or may
not be be bash, usually depending on whether the system in question
preferred to have one less package installed (in which case it is bash)
vs. have a faster /bin/sh installed (in which case it is probably the
dash shell).
2024-01-24 23:01:24 +00:00
Florian Weimer
665d1d4657 Build with -D_DEFAULT_SOURCE along with -std=c11
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.
2023-11-29 13:58:35 +00:00
Francesco Montorsi
b6ca9b2983 Feature: modernize API documentation
* 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
2023-10-25 23:59:38 +02:00
Luca Boccassi
dbb7e3dc01 Problem: 4.3.5 is out, need new version
Solution: bump to 4.3.6
2023-10-09 12:21:03 +01:00
Luca Boccassi
ff47aeb791 Problem: no permission to relicense tweetnacl integration
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.
2023-06-04 23:54:31 +01:00
Luca Boccassi
3919956535 Problem: build fails with PGM + CXX98 + clang++
Solution: redefine 'restrict' which is used as an attribute in PGM headers,
but that is not available when using clang and CXX98
2023-01-11 23:43:13 +00:00
Dimitris Apostolou
6b8dd84a63
Fix typos 2022-02-11 00:45:06 +02:00
fanquake
6473bf4166 problem: kevent udata is now void* on NetBSD Current (10)
solution: check for the intptr_t variant in configure.
2022-01-03 18:03:14 +00:00
fanquake
25d0a280e0
problem: typo in configure.ac output
solution: fix the typo
2022-01-03 19:44:07 +08:00
David Gloe
240e36af4e Problem: Fix fork detection on gcc 7
Solution: When compiling with gcc 7 and newer, the program produced by
AC_CHECK_FUNCS(fork) produces a warning, which results in configure
incorrectly disabling fork support. Fix the issue by using an
AC_COMPILE_IFELSE which correctly detects fork availability.
Tested by running configure and make check on a system with gcc 7
installed, and verifying that HAVE_FORK was defined correctly.

See issue #3313.
2021-11-23 15:47:57 +00:00
E. G. Patrick Bos
9fbfa40bab Problem: when linking to libzmq in my project, I want zmq symbols to remain invisible to users of my library. There is no way to control this, since visibility is set automatically through ZMQ_EXPORT based on OS and compiler.
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.
2021-10-07 10:48:58 +01:00
E. G. Patrick Bos
36e4c9b474
add zmq_ppoll
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.
2021-09-24 11:04:20 +02:00
Min RK
bcb659e00e
Problem: calling randombytes_close with libsodium can crash Contexts in other threads (#4242)
* 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.
2021-08-13 15:11:29 +01:00
Chris Thrasher
4fc83178aa Use standard C11 and C++11
Retain GNU extensions for C99 and C++98 since testing old compilers
is especially difficult and these compilation modes exist to maintain
compatability.
2021-07-01 09:37:02 -06:00
Luca Boccassi
cef3225370 Problem: 4.3.4 is out, need new version
Solution: bump to 4.3.5
2021-01-17 12:10:01 +00:00
Andy Heroff
2998ff34aa
Problem: No direct support for setting socket priority (#4118)
* 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.
2021-01-06 22:22:41 +00:00
Stanisław Maciaś
26cbd4f43f if_nametoindex function is now used when available 2020-12-23 12:32:16 +01:00
Fabrice Fontaine
8cb5708829 src/compat.hpp: fix build with libbsd and strlcpy
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>
2020-11-02 07:58:01 +01:00
Luca Boccassi
f2e364777e Problem: 4.3.3 is out, need new version
Solution: bump to 4.3.4
2020-09-07 11:12:14 +01:00
Fabrice Fontaine
883d432c29 configure.ac: fix build with openpgm-5-3-128
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-09-02 07:54:36 +02:00
fanquake
3a7b77d5f6
build: compile with -Werror by default on Darwin
Using -Werror has been disabled for Darwin since very early on in the
codebase. However at this point, I can't see an obvious reason why it
should still be disabled compared to when building for the other
operating systems.

I've tested compiling on macOS using Apple Clang 11.0.3, LLVM Clang
10.0.0 and GCC 10.1.
2020-07-21 16:08:21 +08:00
Luca Boccassi
1529ffbf42
Merge pull request #3986 from fanquake/ipc_mingw_cross_compile
build: disable IPC when cross-compiling with mingw
2020-07-07 09:11:42 +01:00
Luca Boccassi
4b4e19f915
Merge pull request #3985 from fanquake/test_flag_before_turning_off_warnings
build: test for warning options before enabling -Wno-* variant
2020-07-07 09:10:52 +01:00
fanquake
a396b780fd
build: disable IPC when cross-compiling with mingw
Master doesn't currently compile when crossing compiling using
autotools and mingw-w64. i.e:

```bash
x86_64-w64-mingw32-g++ (GCC) 9.3.0

./autogen.sh
./configure --host=x86_64-w64-mingw32
make src/libzmq.la
....
  CXX      src/libzmq_la-curve_server.lo
In file included from src/address.cpp:37:
src/ipc_address.hpp:40:10: fatal error: sys/socket.h: No such file or directory
   40 | #include <sys/socket.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
```

I assume this hasn't been caught because appveyor is using CMake.

Mingw also does not have an afunix.h header. There is a thread upstream,
but there doesn't seem to have been any discussion:
https://sourceforge.net/p/mingw-w64/discussion/723797/thread/4c8ecdbe0d/.
2020-07-07 13:25:21 +08:00
fanquake
fc5239e880
build: test for warning options before enabling -Wno-* variant
Some compilers, like GCC, will only warn about unknown -Wno-* options
when other warnings are being thrown, i.e:
```bash
  CXX      src/libzmq_la-address.lo
src/address.cpp: In function 'zmq::zmq_socklen_t zmq::get_socket_address(zmq::fd_t, zmq::socket_end_t, sockaddr_storage*)':
src/address.cpp:137:9: warning: unused variable 'unused' [-Wunused-variable]
  137 |     int unused;
      |         ^~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option '-Wno-tautological-constant-compare' may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option '-Wno-atomic-alignment' may have been intended to silence earlier diagnostics
  CXX      src/libzmq_la-channel.lo
```

They will also seem to accept the -Wno-* variant when it's tested for
using AX_CHECK_COMPILE_FLAG. So, rather than test for -Wno-* variants
that the compiler may pretend to understand, test for the actual option,
and only enable the -Wno-* case when it is available.
2020-07-07 11:06:44 +08:00
fanquake
f26b1ad8bb
build: don't compile with -Wno-uninitialized on darwin
This flag has been enabled for Darwin targets since the initial commit
in 4ed70a930202b103e7e80b8dc925e0aaa4622595. However, aside from the
fact that we likely no longer want to suppress uninitialized warnings,
this flag wont suppress them anyways, as it's included in the
CXX flags before -Wall (which enables -Wuninitialized). i.e:

```bash
g++ -std=gnu++11 ... -Wno-uninitialized ... -Wall <rest of flags>
```
2020-07-07 09:48:11 +08:00
Bill Torpey
c1d195641d
provide minimal support for TSAN (#3929)
* provide minimal support for thread sanitizer
2020-05-20 20:01:29 +01:00
Luca Boccassi
5b7f67a822 Problem: memory sanitizer not enabled in CI
Solution: add -fsanitize=leak to the sanitizers flag, and disable
test_many_sockets as it currently fails due to:
https://github.com/zeromq/libzmq/issues/3898
2020-05-06 00:14:02 +01:00
Luca Boccassi
3770937de3 Problem: we want to check for undefined behaviour in the CI
Solution: enable GCC's UBSAN in the sanitizer job
2020-05-05 12:58:39 +01:00
Luca Boccassi
8e774f3cd6 Problem: no integration with fuzz testing
Solution: port the 2 new tests from oss-fuzz, and wire them up to
be ran manually with a static input in normal builds.
Add a specific configure option to use the external fuzzing engine
from oss-fuzz.
2020-04-27 01:18:08 +01:00
Luca Boccassi
1f00a5bf59 Problem: WS build option is independent of DRAFT
Solution: make the default depend on the value of the DRAFT build flag
2020-01-19 16:36:29 +00:00
Luca Boccassi
9d2899af87 Problem: libzmq.pc does not include gnutls dependency for static linking
Solution: add it to the Requires.private list
2019-12-28 21:17:09 +01:00
Luca Boccassi
068385c951 Problem: internal reimplementation of strlcpy used by default on Linux
Solution: use libbsd by default when available, and the internal implementation
only as a fallback, to take advantage of Linux distros maintenance of the
string libraries.
2019-12-28 16:21:06 +01:00
Simon Giesecke
334e837b88 Problem: ws_engine uses unsafe strcpy
Solution: use strcpy_s instead (define custom if not available)
2019-12-25 13:56:26 +01:00
Simon Giesecke
66d0f3511f Problem: ipc transport not supported under Windows
Solution: implement support
2019-10-29 23:04:54 +01:00
ThePrez
25320a3c7b
Add IBM i build support via 'os400' clause 2019-10-02 15:21:28 -05:00
somdoron
7296fb5b15 problem: unsecured websocket is rarely used in production
Solution: support websocket with tls (wss)
2019-10-02 08:58:26 +03:00
Dima Pasechnik
a25e3168bb
Allow "configure --disable-maintainer-mode"
Allow "configure --disable-maintainer-mode" to disable timestamp checking.
This is useful for one-off builds, in particular on e.g. clusters, where slightly skew clocks force aclocal and friends to kick in for no good reason.
2019-09-18 16:20:22 +01:00
Luca Boccassi
3e4c90bbf4 Problem: package build fails on SUSE Tumbleweed
Solution: add -ffat-lto-objects if the compiler supports it
2019-09-11 16:02:10 +01:00
somdoron
9be8334938 problem: sha1 external module conflict with czmq
Solution: allow to use external library (nss) for sha1 to avoid the conflict
2019-09-11 15:01:28 +03:00
Christopher Hall
ba679bcce8 problem: configure for DragonFly need FreeBSD also defined
solution: on DragonFly also define ZMQ_HAVE_FREEBSD
          in addition to ZMQ_HAVe_DRAGONFLY

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
2019-08-06 12:11:00 +08:00
Luca Boccassi
491a0ae107 Problem: 4.3.2 is out, need new version
Solution: bump to 4.3.3
2019-07-08 17:57:12 +01:00
Alain Kalker
9a397666d2 acinclude.m4, configure.ac: Fix several non-portable uses of test
Fixes #3517
2019-05-22 01:30:54 +02:00
Luca Boccassi
ca2e8b3b19 Problem: build broken on Fedora 30
Solution: use AC_COMPILE_IFELSE instead of AC_CHECK_FUNCS to check for
strnlen, as the latter does not work anymore.
2019-05-04 16:14:58 +01:00
Jacques Germishuys
b26542bbfc Problem: strnlen may not be available
Solution: Provide an implementation
2019-03-18 11:37:53 +00:00
Simon Giesecke
120edd9809 Problem: selection of condition_variable_t implementation is confusing and not configurable
Solution: move configuration to build definition
2019-02-12 03:47:26 -05:00
Luca Boccassi
8040e28b26 Problem: posix_memalign autoconf check broken on some platforms
Solution: import macro from autoconf-archive that works better
than AC_CHECK_FUNCS
2019-01-19 21:06:23 +00:00
Luca Boccassi
4a0c83fb12 Problem: yqueue false sharing issues on PPC64
Solution: detect cacheline size for aligment purposes at build time
instead of hard-coding it, so that PPC and S390 can align to a value
greater than the 64 bytes default.
Uses libc getconf program, and falls back to the previous value of 64
if not found.
2019-01-19 20:08:14 +00:00
Luca Boccassi
73ae7a349b Problem: gssapi pkg-config check in configure.ac does not work
Solution: correctly enable the definition in platform.hpp so that the
gssapi support is actually built in if requested and available.
2019-01-14 14:51:03 +00:00