eclipse-paho / paho.mqtt.cpp

Other
1.03k stars 438 forks source link

cmake issue in Docker container #479

Closed DylanCavers closed 9 months ago

DylanCavers commented 9 months ago

Hi, I'm trying to get Paho C++ up and running in a container, but having issues with the install. This is working fine outside of the container but fails when I try to build inside. Any help would be much appreciated.

Seem to also be getting a similar issue to #469.

Here's the install in the Dockerfile. (edit: parent image is ubuntu:latest)

# Install Paho C
WORKDIR /home
RUN git clone https://github.com/eclipse/paho.mqtt.c.git
WORKDIR /home/paho.mqtt.c
RUN git checkout v1.3.13
RUN cmake -Bbuild -H. -DPAHO_ENABLE_TESTING=OFF -DPAHO_BUILD_STATIC=ON -DPAHO_WITH_SSL=ON -DPAHO_HIGH_PERFORMANCE=ON
RUN sudo cmake --build build/ --target install
RUN sudo ldconfig

# Install Paho C++
WORKDIR /home
RUN git clone https://github.com/eclipse/paho.mqtt.cpp.git
WORKDIR /home/paho.mqtt.cpp
RUN cmake -Bbuild -H. -DPAHO_WITH_MQTT_C=ON -DPAHO_BUILD_STATIC=ON -DPAHO_BUILD_DOCUMENTATION=OFF -DPAHO_BUILD_SAMPLES=OFF
RUN sudo cmake --build build/ --target install
RUN sudo ldconfig

And getting the following error

CMake Error at CMakeLists.txt:60 (add_subdirectory):
  add_subdirectory given source "/home/paho.mqtt.cpp/externals/paho-mqtt-c"
  which is not an existing directory.

CMake Error at CMakeLists.txt:64 (add_library):
  add_library cannot create ALIAS target "eclipse-paho-mqtt-c::paho-mqtt3a"
  because target "paho-mqtt3a" does not already exist.

CMake Error at CMakeLists.txt:66 (add_library):
  add_library cannot create ALIAS target "eclipse-paho-mqtt-c::paho-mqtt3as"
  because target "paho-mqtt3as" does not already exist.

update: for anyone unable to install at the moment here's my temp fix until the main issue is resolved. not ideal as it uses a version from last summer but still has basic support, also drops the clone of the paho c repo in favour of git submodules, which is much nicer.

WORKDIR /home
RUN git clone --recurse-submodules https://github.com/eclipse/paho.mqtt.cpp.git
WORKDIR /home/paho.mqtt.cpp
RUN git checkout ef021805c7aca42d72194d85bb2bdccdfe963e28
RUN cmake -Bbuild -H. -DPAHO_WITH_MQTT_C=ON -DPAHO_BUILD_STATIC=ON -DPAHO_BUILD_DOCUMENTATION=OFF -DPAHO_BUILD_SAMPLES=ON
RUN sudo cmake --build build/ --target install
RUN sudo ldconfig
AngelChik11 commented 9 months ago

Same issue on Ubuntu 16.10 under CMake 3.5.2... (((

fpagliughi commented 9 months ago

Normally we try to keep the master branch relatively stable, but at the moment there is some churn leading up to the next release. Don’t rely on it for your production code.

Check out the tag for the latest release, “v1.3.2” (like you’re doing for the C lib) or wget the release tarball and build that.