Skip to content

fix pthreads link - #148

Merged
ecbadeaux merged 1 commit into
mainfrom
fix-test-server-pthread-link
Oct 29, 2026
Merged

ecbadeaux merged 1 commit into
mainfrom
fix-test-server-pthread-link

Conversation

@ecbadeaux

Copy link
Copy Markdown
Contributor

Link Threads::Threads wherever Boost.Asio is used

Summary

Fix undefined pthread_* link errors in the udp_server and uds_server test helpers on toolchains where the thread library is a separate libpthread.

Problem

#139 changed several targets from Boost::system to the header-only Boost::boost. Boost::system was what pulled -pthread into the link line. After the change, udp_server and uds_server link no thread library at all, even though Boost.Asio needs one. The link fails on an older Linux toolchain with:

undefined reference to `pthread_create'
undefined reference to `pthread_join'
undefined reference to `pthread_detach'
undefined reference to `pthread_sigmask'
undefined reference to `pthread_condattr_setclock'

I found this when the atlas-system-agent package build (which builds spectator-cpp via add_subdirectory) failed after moving to v2.4.1.

Changes

  • CMakeLists.txt: add find_package(Threads REQUIRED).
  • udp_server and uds_server executables: link Threads::Threads. This is the fix for the errors above.
  • udp_server_lib and uds_server_lib: replace the bare pthread with Threads::Threads.
  • spectator-writer-types and spectator-registry: link Threads::Threads publicly, so consumers of the libraries get the thread flag instead of relying on a transitive dependency. This guards against the same failure in other targets.

Follow-up

Tag v2.4.2 after merging, so atlas-system-agent can repin to it.

@ecbadeaux
ecbadeaux merged commit 00bc7c7 into main Oct 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant