tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: websockets cmake woes
On Sun, 13 Oct 2024 10:29:05 -0400
Greg Troxel <gdt%lexort.com@localhost> wrote:
> I just updated mosquitto, which uses websockets. That exposed a bug
> in the libwebsockets package. This message is about that bug.
>
> mosquitto has
>
> set (MOSQ_LIBS ${MOSQ_LIBS} websockets_shared)
>
> when asked to use websockets. This seemed bizarre to me, but
> apparently this is how the cmake files installed by libwebsockets are
> supposed to work.
>
> In /usr/pkg/lib/cmake/libwebsockets/LibwebsocketsTargets.cmake
> there is, apparently directly from upstream:
>
> set_target_properties(websockets_shared PROPERTIES
> INTERFACE_INCLUDE_DIRECTORIES
> "${_IMPORT_PREFIX}/include;/usr/include" INTERFACE_LINK_LIBRARIES
> "dl;/usr/lib/libssl.so;/usr/lib/libcrypto.so;/usr/lib/libssl.so;/usr/lib/libcrypto.so"
> )
>
> and the result is injecting -ldl into the mosquitto build. That's
> wrong on many systems, including *BSD.
>
> objdump shows websockets needs
>
> NEEDED libssl.so.15
> NEEDED libcrypto.so.15
> NEEDED libc.so.12
>
> and websockets's bl3 includes openssl, so all is ok from the
> straightforward pkgsrc viewpoint.
>
> The question is then what is the root cause of this (besides "cmake",
> which while not wrong, is unhelpful).
>
> It seems websockets has defined some complicated scheme supporting
> static and shared libs, but we aren't playing along. But, I can't
> see anything in the Makefile that tries to change upstream.
>
The root cause is in lib/CMakeLists.txt where just as nia mentions it
links directly to libdl. I have added a patch to libwebsockets that
makes it link to ${CMAKE_DL_LIBS} instead and it only links privately
to libdl so dl should not turn up on the INTERFACE_LINK_LIBRARIES list
on systems that have libdl either. Try it.
Regards,
Niclas
Home |
Main Index |
Thread Index |
Old Index