I have noticed a difference between the autotools build and the CMake build when computing the definitions concerning the thread name and affinities (ZMQ_HAVE_PTHREAD_SETNAME_1, ZMQ_HAVE_PTHREAD_SETNAME_2, ZMQ_HAVE_PTHREAD_SETNAME_3, ZMQ_HAVE_PTHREAD_SET_NAME, ZMQ_HAVE_PTHREAD_SET_AFFINITY).
When using the autotools build, a compilation test is done to set the definitions. When using the CMake build, an execution test is done to set those same definitions. This has an incidence when libzmq is cross-compiled as compilation tests can be done, but not execution tests. So, when cross-compiling with autotools, those definitions are set if the target system has the capabilities, but not when cross-compiling with CMake.
Environment
libzmq version (commit hash if unreleased): 4.3.4
OS: Linux
Minimal test code / Steps to reproduce the issue
Cross-compile libzmq for a target that have the non-portable functions to set the name and affinity (ex. compiling for Linux aarch64 from Linux x86_64), with autotools
Do the same thing, but with CMake
What's the actual result? (include assertion message & call stack if applicable)
Undefined symbols pthread_setaffinity_np and pthread_setname_np are present in the library libzmq.so built by autotools, indicating those functions are called by libzmq.
Undefined symbols pthread_setaffinity_np and pthread_setname_np are not present in the library libzmq.so built by CMake, indicating those functions are not called by libzmq.
What's the expected result?
Undefined symbols pthread_setaffinity_np and pthread_setname_np are present in the library libzmq.so built by autotools and CMake.
Issue description
I have noticed a difference between the autotools build and the CMake build when computing the definitions concerning the thread name and affinities (ZMQ_HAVE_PTHREAD_SETNAME_1, ZMQ_HAVE_PTHREAD_SETNAME_2, ZMQ_HAVE_PTHREAD_SETNAME_3, ZMQ_HAVE_PTHREAD_SET_NAME, ZMQ_HAVE_PTHREAD_SET_AFFINITY).
When using the autotools build, a compilation test is done to set the definitions. When using the CMake build, an execution test is done to set those same definitions. This has an incidence when libzmq is cross-compiled as compilation tests can be done, but not execution tests. So, when cross-compiling with autotools, those definitions are set if the target system has the capabilities, but not when cross-compiling with CMake.
Environment
Minimal test code / Steps to reproduce the issue
What's the actual result? (include assertion message & call stack if applicable)
Undefined symbols pthread_setaffinity_np and pthread_setname_np are present in the library libzmq.so built by autotools, indicating those functions are called by libzmq. Undefined symbols pthread_setaffinity_np and pthread_setname_np are not present in the library libzmq.so built by CMake, indicating those functions are not called by libzmq.
What's the expected result?
Undefined symbols pthread_setaffinity_np and pthread_setname_np are present in the library libzmq.so built by autotools and CMake.