This commit updates the Dockerfile to use multiple stages. In the first stage, compile-time dependencies are installed, and libzmq is compiled and tested. The second stage starts with a fresh, slim Docker image, and the compiled outputs of the first stage are copied over. Runtime dependencies, like libsodium and kerberos, are installed as well.
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.
* build_ios.sh now build for different archs
* change typo on build_ios.sh
Co-authored-by: Roberto Santacroce Martins <roberto.martins@transferoswiss.ch>
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/.
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.
This flag has been enabled for Darwin targets since the initial commit
in 4ed70a9302. 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>
```
Solution: move all corpora to the zeromq/libzmq-fuzz-corpora repository
for easier handling, and to avoid inflating the size of zeromq/libzmq.
Clone it for the CI on the fly.
Solution: check if a session's _pipe has been allocated before using
it, since as a consequence of creating the pipes after the handshake
it's no longer guaranteed to be there.
Fixes#3971
Fixed three things:
1. Moved asterisks by variable names into the single quotes (to match [zmq_poll](https://github.com/zeromq/libzmq/edit/master/doc/zmq_init.txt) and other pages.)
2. Fixed variable name in example.
3. Fixed extra & in example.
Solution: only process for sub/cancel if the messages are actually sub/cancel.
Regression introduced by cf9ccbb which tried to skip non-sub/cancel processing
for PUB.