wanghaEMQ / pynng-mqtt

MIT License
9 stars 3 forks source link

Problems building the dependencies #9

Open MoisesGonzalezS opened 5 months ago

MoisesGonzalezS commented 5 months ago

Description

I tried to test the latest master but I wasn't able to finish the installation process. While doing pip install -e . i got the following error:

    -- Looking for mbedtls_ssl_init
    -- Looking for mbedtls_ssl_init - not found
    Mbed TLS too old (must be version 2 or newer)  UP
    CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
      Could NOT find MbedTLS (missing: MbedTLS_VERSION)
    Call Stack (most recent call first):
      /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
      cmake/FindMbedTLS.cmake:117 (find_package_handle_standard_args)
      src/supplemental/tls/mbedtls/CMakeLists.txt:32 (find_package)

I tried to run it on a Dockerfile as follows:

FROM ubuntu:22.04 AS base

RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt/lists \
    apt-get update && \
    apt-get install -y git cmake clang python3-venv python3-dev python3-pip ninja-build

WORKDIR /app

FROM base AS code

RUN git clone https://github.com/wanghaEMQ/pynng-mqtt.git

RUN cd pynng-mqtt && git submodule update --init --recursive

RUN mkdir -p pynng-mqtt/nng/extern/msquic/build && cd pynng-mqtt/nng/extern/msquic/build && cmake ..

RUN pip install 'jinja2<3' jsonschema

Is there something that I'm missing?

MoisesGonzalezS commented 5 months ago

In the end I adjusted this line to make the build pass:

https://github.com/wanghaEMQ/pynng-mqtt/blob/master/setup.py#L81

-        '-DMBEDTLS_ROOT_DIR={}/mbedtls/prefix/'.format(THIS_DIR),
+        '-DMBEDTLS_ROOT={}/mbedtls/prefix/'.format(THIS_DIR),

I'm don't really know my way arround cmake but seems like this doesn't properly use MBEDTLS_ROOT_DIR as fallback: https://github.com/emqx/NanoSDK/commit/7baec6f57d9fbfca264e85ce865e10e0d6c68963