Opened 9 months ago

Last modified 9 months ago

#67874 assigned update

mosquitto: update to 2.0.16

Reported by: danh1979 Owned by: slewsys (Andrew L. Moore)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: haspatch Cc: slewsys (Andrew L. Moore)
Port: mosquitto

Description (last modified by danh1979)

This was tested on Ventura 13.5 on M2 Pro by creating my own local Portfile and installing it from source. After some Internet-search-aided debugging, I found that I needed to:

  • add libcjson dependency
  • deal with missing symbols via the extra linker flag
  • deal with an xslt error by installing docbook XSL

Code highlighting:

  • net/mosquitto/Portfile

    diff --git a/net/mosquitto/Portfile b/net/mosquitto/Portfile
    index 61e7927e..750e462f 100644
    a b PortSystem 1.0 
    44PortGroup           cmake 1.1
    55
    66name                mosquitto
    7 version             2.0.9
    8 revision            1
     7version             2.0.16
     8revision            0
    99
    1010categories          net devel
    1111platforms           darwin
    long_description \ 
    2121    both  C and C++ client libraries.
    2222
    2323homepage            https://mosquitto.org
    24 master_sites        http://mosquitto.org/files/source/
     24master_sites        ${homepage}/files/source/
    2525
    26 checksums           rmd160  6925455f51b6c79ebd160aba2f3709864aa5c05d \
    27                     sha256  1b8553ef64a1cf5e4f4cfbe098330ae612adccd3d37f35b2db6f6fab501b01d4 \
    28                     size    757878
     26checksums           rmd160  1f0e5e1a1e700a06af52509fd132702ef7d04a1c \
     27                    sha256  638db9e43e89d243ea98d10d66e76ff376131217780decd01abaffacc66d8035 \
     28                    size    795906
    2929
    3030depends_build-append \
    31                     path:bin/xsltproc:libxslt
     31                    path:bin/xsltproc:libxslt \
     32                    port:docbook-xsl-nons
    3233
    3334depends_lib         port:c-ares \
     35                    port:libcjson \
    3436                    port:libwebsockets \
    3537                    port:tcp_wrappers \
    3638                    path:lib/libssl.dylib:openssl
    depends_lib port:c-ares \ 
    3840depends_test-append \
    3941                    port:python27
    4042
     43patchfiles CMAKE_MODULE_LINKER_FLAGS.patch
     44
    4145configure.args-append \
    4246                    -DUSE_LIBWRAP:BOOL=ON \
    4347                    -DWITH_SRV:BOOL=ON \
  • new file net/mosquitto/files/CMAKE_MODULE_LINKER_FLAGS.patch

    diff --git a/net/mosquitto/files/CMAKE_MODULE_LINKER_FLAGS.patch b/net/mosquitto/files/CMAKE_MODULE_LINKER_FLAGS.patch
    new file mode 100644
    index 00000000..ec3044ea
    - +  
     1--- CMakeLists.txt.orig 2023-08-03 23:00:17
     2+++ CMakeLists.txt      2023-08-03 23:00:13
     3@@ -20,7 +20,7 @@
     4 endif (WIN32)
     5 
     6 if(APPLE)
     7-       set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
     8+       set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")
     9 endif(APPLE)
     10 
     11 include(GNUInstallDirs)
     12

Attachments (2)

macports-ports.mosquitto-2.0.15.patch (2.3 KB) - added by danh1979 9 months ago.
macports-ports.mosquitto-2.0.15.patch
macports-ports.mosquitto-2.0.16.patch (2.3 KB) - added by danh1979 9 months ago.
mosquitto: update to 2.0.16

Download all attachments as: .zip

Change History (8)

comment:1 Changed 9 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to slewsys
Status: newassigned

revision should drop to 0 when the version is increased.

http://mosquitto.org redirects to https://mosquitto.org so master_sites should be changed to ${homepage}/files/source/.

Needing to specify -undefined dynamic_lookup manually is surprising and suggests a bug in the build system. What error did you get before adding that? Did you file a bug report with upstream? Please provide its URL.

comment:2 Changed 9 months ago by ryandesign (Ryan Carsten Schmidt)

Summary: update mosquitto to 2.0.15mosquitto: update to 2.0.15

comment:3 Changed 9 months ago by danh1979

Description: modified (diff)

I updated the patch with the revision and master_sites suggestions.

Regarding -undefined dynamic_lookup, it seems there are some plugins in mosquitto, written add_library(targetname MODULE ...) in cmake, where targetname is one of these three:

  • mosquitto_dynamic_security
  • mosquitto_message_timestamp
  • mosquitto_payload_modification

These don't compile without adding -DCMAKE_MODULE_LINKER_FLAGS="-undefined dynamic_lookup".

Prompted by your suggestion, and then learning about cmake-1.1.tcl and recreating a macports-equivalent build environment, I searched the mosquitto source and found

https://github.com/eclipse/mosquitto/blob/v2.0.15/CMakeLists.txt#L22

If I change this to

  • CMakeLists.txt

    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index b8913c2d..145f6255 100644
    a b if (WIN32) 
    2020endif (WIN32)
    2121
    2222if(APPLE)
    23        set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
     23       set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")
    2424endif(APPLE)
    2525
    2626include(GNUInstallDirs)

... then mosquitto builds without -DCMAKE_MODULE_LINKER_FLAGS="-undefined dynamic_lookup" fed on the cmake command line.

comment:4 Changed 9 months ago by danh1979

Description: modified (diff)

modified patch for this port to use a patch for mosquitto's CMakeLists.txt instead of an extra command line arg

comment:5 Changed 9 months ago by danh1979

Looks like mosquitto already has an issue; I added a comment https://github.com/eclipse/mosquitto/issues/2858

Changed 9 months ago by danh1979

macports-ports.mosquitto-2.0.15.patch

Changed 9 months ago by danh1979

mosquitto: update to 2.0.16

comment:6 Changed 9 months ago by danh1979

Description: modified (diff)
Summary: mosquitto: update to 2.0.15mosquitto: update to 2.0.16
Note: See TracTickets for help on using tickets.