Hi,
we just noticed that the CMake build process could not find a pthread_setname_np() implementation.
-- Performing Test ZMQ_HAVE_PTHREAD_SETNAME_1
-- Performing Test ZMQ_HAVE_PTHREAD_SETNAME_1 - Failed
-- Performing Test ZMQ_HAVE_PTHREAD_SETNAME_2
-- Performing Test ZMQ_HAVE_PTHREAD_SETNAME_2 - Failed
-- Performing Test ZMQ_HAVE_PTHREAD_SETNAME_3
-- Performing Test ZMQ_HAVE_PTHREAD_SETNAME_3 - Failed
-- Performing Test ZMQ_HAVE_PTHREAD_SET_NAME
-- Performing Test ZMQ_HAVE_PTHREAD_SET_NAME - Failed
-- Performing Test ZMQ_HAVE_PTHREAD_SET_AFFINITY
-- Performing Test ZMQ_HAVE_PTHREAD_SET_AFFINITY - Failed
We got regular debian, so the 2 parameter version is there. Also set affinity function.
So we did a bit of digging. Turns out, we got CFLAGS="-Wall -Wextra" (or CMAKE_C_FLAGS) set. This goes into those checks. You enable "-Werror" (here) and then each compilation fails with:
/home/USER/libzmq/build/CMakeFiles/CMakeScratch/TryCompile-3a3Qy9/src.c:4:14: error: unused parameter ‘argc’ [-Werror=unused-parameter]
4 | int main(int argc, char *argv [])
| ~~~~^~~~
/home/USER/libzmq/build/CMakeFiles/CMakeScratch/TryCompile-3a3Qy9/src.c:4:26: error: unused parameter ‘argv’ [-Werror=unused-parameter]
4 | int main(int argc, char *argv [])
| ~~~~~~^~~~~~~
We know how to fix this on our side but I still am raising an issue here, cause this could also happen elsewhere. The compilation silently continues, but in the end, no thread name or affinity is set. Especially for affinity this could cause some serious issues on realtime usage.
I got 2 possible solutions:
A) Drop the -Werror. The compilation should fail either way, if the header does not have the signature.
B) Also add all warning levels (also -Wpedantic) to the compile check and ensure that the test code produces no warnings. Then it should be safe if someone globally sets extra warning levels (like we did).
PS: The automake toolchain probably does not have this issue (not tested). It does not specify a main, it probably autogenerats a function and it is probably clean.
Hi,
we just noticed that the CMake build process could not find a pthread_setname_np() implementation.
We got regular debian, so the 2 parameter version is there. Also set affinity function.
So we did a bit of digging. Turns out, we got CFLAGS="-Wall -Wextra" (or CMAKE_C_FLAGS) set. This goes into those checks. You enable "-Werror" (here) and then each compilation fails with:
We know how to fix this on our side but I still am raising an issue here, cause this could also happen elsewhere. The compilation silently continues, but in the end, no thread name or affinity is set. Especially for affinity this could cause some serious issues on realtime usage.
I got 2 possible solutions:
A) Drop the -Werror. The compilation should fail either way, if the header does not have the signature.
B) Also add all warning levels (also -Wpedantic) to the compile check and ensure that the test code produces no warnings. Then it should be safe if someone globally sets extra warning levels (like we did).
PS: The automake toolchain probably does not have this issue (not tested). It does not specify a main, it probably autogenerats a function and it is probably clean.