eclipse-mosquitto / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
9.12k stars 2.41k forks source link

libwebsockets is linked statically #2880

Open narc-Ontakac2 opened 1 year ago

narc-Ontakac2 commented 1 year ago

Looking at the linker options when building with debuild on Debian bookworm I see

-lrt /usr/lib/x86_64-linux-gnu/libwebsockets.a

which tells me that libwebsockets is linked statically. In case that it is intentional and I overlooked a not so obvious switch - why?

The obvious switch in src/CMakeLists.txt tells me otherwise:

option(STATIC_WEBSOCKETS "Use the static libwebsockets library?" OFF)
narc-Ontakac2 commented 1 year ago

Libwebsockets changed its cmake interface. This adapts to that:

 if (WITH_WEBSOCKETS)
    if (STATIC_WEBSOCKETS)
-       set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static)
+       set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
        if (WIN32)
            set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi)
            link_directories(${mosquitto_SOURCE_DIR})
        endif (WIN32)
    else (STATIC_WEBSOCKETS)
-       set (MOSQ_LIBS ${MOSQ_LIBS} websockets)
+       set (MOSQ_LIBS ${MOSQ_LIBS} websockets_shared)
    endif (STATIC_WEBSOCKETS)
 endif (WITH_WEBSOCKETS)