Solution: ignore tautological-constant-compare warnings, as they
might be useless on 64 bit but they are not on 32 bit where sizeof
size_t != sizeof uint64_t
Problem: When building libzmq with CMake, the installed libzmq.dylib
has a relative install name (otool -D libzmq.dylib) on MacOS. This
is a regression against building via autotools which sets an
absolute install name. Effectively, the CMake built libzmq.dylib
is rendered useless if installed in non-system directories and
used in environments without explicit DYLD_LIBRARY_PATH mgmt. For
example running any of the installed executables currently fails:
$ /some_install_prefix/bin/inproc_lat
dyld: Library not loaded: libzmq.5.dylib
Referenced from: /some_install_prefix/bin/inproc_lat
Reason: image not found
Trace/BPT trap: 5
Solution: Best practice is to install relocatable dylibs.
On MacOS this means setting an install name with a special prefix,
e.g. @rpath/libzmq.dylib, and adding the relevant search paths
to the embedded rpath list. In this patch the necessary CMake options
are added to generate the desired relocatable dylibs. Find more
information on: https://cmake.org/Wiki/CMake_RPATH_handling.
Solution: remove objects optimisation in library build (similar to #2860)
and set PUBLIC compile definitions on all static builds instead of MSVC
only.
Solution: change case of `WinSock2.h Iphlpapi.h Rpc.h` to match the
files on disk. This is only noticeable when cross-compiling from a
case-sensitive system so wouldn't get picked up in MSVC or mingw
builds running on a windows machine.
MSDN uses capitalised versions in prose and lowercase in code examples:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms737629(v=vs.85).aspxFixes#2978, the missing library message is a little misleading.
This fixes an error with the cmake install configuration, which
attempted an invalid copy of a .pdb file on windows, when the
BUILD_SHARED option is disabled.
Solution: revert the objects optimisation, and go back to building
everything twice on Windows, as the static builds needs different
preprocessor definitions from the shared one, so the objects have to be
rebuilt.
Keep the optimisation for all the other platforms.
Fixes#2858
* Background thread scheduling
- add ZMQ_THREAD_AFFINITY ctx option; set all thread scheduling options
from the context of the secondary thread instead of using the main
process thread context!
- change ZMQ_THREAD_PRIORITY to support setting NICE of the background
thread when using SCHED_OTHER
Linux now supports Virtual Routing and Forwarding (VRF) as per:
https://www.kernel.org/doc/Documentation/networking/vrf.txt
In order for an application to bind or connect to a socket with an
address in a VRF, they need to first bind the socket to the VRF device:
setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1);
Note "dev" is the VRF device, eg. VRF "blue", rather than an interface
enslaved to the VRF.
Add a new socket option, ZMQ_BINDTODEVICE, to bind a socket to a device.
In general, if a socket is bound to a device, eg. an interface, only
packets received from that particular device are processed by the socket.
If device is a VRF device, then subsequent binds/connects to that socket
use addresses in the VRF routing table.
Solution: we can use 'CMAKE_SYSTEM_VERSION' instead of
'${CMAKE_SYSTEM_VERSION}' for the 'if' clauses.
CMake fails to evaluate condition when CMAKE_SYSTEM_VERSION is
empty, which can happen with a default installation of Mingw-w64
in Linux.
Some #define switches cause the body of entire files to be omitted. This
causes a linker warning on Visual Studio 2017, for example
warning LNK4221: This object file does not define any previously
undefined public symbols, so it will not be used by any link
operation that consumes this library
Since this is warning us about something that shouldn't be
earth-shattering news, we add a linker flag to suppress this warning on
MSVC builds.