Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unix: Fix linker errors when building without sdevent #3287

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dddaniel
Copy link

@dddaniel dddaniel commented Dec 2, 2024

When building without systemd event support (-DLWS_WITH_SDEVENT=OFF) on a system that has libsystemd headers installed, lib/plat/unix-systemd.c is build in anyway.
The final libwebsockets library has then references to symbols from libsystemd even though it won't be linked.

Resulting in the follwoing linker errros:

/usr/bin/ld: /usr/local/lib/libwebsockets.so: undefined reference to sd_is_socket_inet' /usr/bin/ld: /usr/local/lib/libwebsockets.so: undefined reference to sd_is_socket_unix' /usr/bin/ld: /usr/local/lib/libwebsockets.so: undefined reference to `sd_listen_fds'

This commit ensures that unix-system.c is only build when LWS_WITH_SDEVENT is set and the system has libsystemd headers installed.

When building without systemd event support (-DLWS_WITH_SDEVENT=OFF) on
a system that has libsystemd headers installed, lib/plat/unix-systemd.c
is build in anyway.
The final libwebsockets library has then references to symbols from
libsystemd even though it won't be linked.

Resulting in the follwoing linker errros:
--
/usr/bin/ld: /usr/local/lib/libwebsockets.so: undefined reference to `sd_is_socket_inet'
/usr/bin/ld: /usr/local/lib/libwebsockets.so: undefined reference to `sd_is_socket_unix'
/usr/bin/ld: /usr/local/lib/libwebsockets.so: undefined reference to `sd_listen_fds'
--

This commit ensures that unix-system.c is only build when LWS_WITH_SDEVENT is set and
the system has libsystemd headers installed.

Signed-off-by: Daniel Danzberger <[email protected]>
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