Skip to content

hal: omit librt from Darwin linking - #4966

Open
smoe wants to merge 1 commit into
LinuxCNC:masterfrom
smoe:codex/darwin-hal-no-lrt-upstream
Open

smoe wants to merge 1 commit into
LinuxCNC:masterfrom
smoe:codex/darwin-hal-no-lrt-upstream

Conversation

@smoe

@smoe smoe commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

The -lrt library may no longer be needed with glibc >= 2.17. And -pthread may go with 2.34. The macOS does not have -lrt but gets the HAL timing functions through libSystem. This patch selects -lrt using the configured host OS and keeps -pthread tied to the uspace build mode.

This patch has no effect on how -lrt is always added on Linux. But it does not add it for the macOS. And arguably it can just be removed in toto since we are using reallocarray which only came with glibc 2.26, so our effective requirements for glibc are higher, anyway.

Darwin supplies the HAL timing functions through libSystem. Select
-lrt using the configured host OS and keep -pthread tied to the
uspace build mode.
@grandixximo

Copy link
Copy Markdown
Contributor

@smoe irrelevant to the PR, do you have weblate admin rights? it needs a rebase

@grandixximo

Copy link
Copy Markdown
Contributor

@BsAtHome the description already suggests dropping -lrt entirely. Since the code needs glibc 2.26 or newer (reallocarray), and clock_gettime has been in libc since 2.17, would you rather see -lrt removed outright than kept behind a Darwin check? If so, it would need to go from all three places: src/hal/Submakefile, src/rtapi/Submakefile (rtapi_app) and PYFLAGS in src/hal/components/Submakefile.

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.

2 participants