Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] paho-mqtt-cpp/1.1: build fails with error "Could NOT find PahoMqttC (missing: PAHO_MQTT_C_LIBRARIES)" #3760

Closed
isnullxbh opened this issue Dec 3, 2020 · 5 comments · Fixed by #4096
Labels
bug Something isn't working

Comments

@isnullxbh
Copy link
Contributor

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: paho-mqtt-cpp/1.1
  • Operating System+version: Arch Linux 5.9.11
  • Compiler+version: Clang 11
  • Conan version: conan 1.31.4
  • Python version: Python 3.9.0

Conan profile

[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=clang
compiler.cppstd=20
compiler.libcxx=libc++
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

Investigation

Step 1. Check helper cmake file

Link:
https://github.com/eclipse/paho.mqtt.cpp, branch: v1.1

In file cmake/FindPahoMqttC.cmake:

# add suffix when using static Paho MQTT C library variant
if(PAHO_BUILD_STATIC)
    set(_PAHO_MQTT_C_LIB_NAME ${_PAHO_MQTT_C_LIB_NAME}-static)
endif()

Step 2. Check paho-mqtt-c build

In ~/.conan/data/paho-mqtt-c/.../package/.../lib:

libpaho-mqtt3as.a # Pay attention - no '-static' suffix

Step 3. Check out the latest changes

Commit:
a79d9f7

def requirements(self):
-   if tools.Version(self.version) >= "1.1":
-       self.requires("paho-mqtt-c/1.3.1")
-   else:
-       self.requires("paho-mqtt-c/1.3.0")
+   self.requires("paho-mqtt-c/1.3.5")

Step 4. Compare CMake files for paho-mqtt-c v1.3.1/v1.3.5

v1.3.1
https://github.com/eclipse/paho.mqtt.c/blob/d34c51214f4172f2e12bb17532c9f44f72a57dd4/src/CMakeLists.txt#L164

v1.3.5
https://github.com/eclipse/paho.mqtt.c/blob/153dfd3a4a1d510697c5d55e169fa158db16e04a/src/CMakeLists.txt#L244

CMakeLists.txt (v1.3.5) contains the following instructions:

SET_TARGET_PROPERTIES(paho-mqtt3cs-static PROPERTIES OUTPUT_NAME paho-mqtt3cs)
SET_TARGET_PROPERTIES(paho-mqtt3as-static PROPERTIES OUTPUT_NAME paho-mqtt3as)

So, paho-mqtt-cpp v1.1 search for the paho-mqtt-c library which name contains '-static' suffix, but the new version of paho-mqtt-c (v1.3.5) doesn't append that suffix.

Quick fix (for lib clients)

# In ~/.conan/data/paho-mqtt-c/.../package/.../lib
cp libpaho-mqtt3as.a libpaho-mqtt3as-static.a

Run Conan again.

Steps to reproduce (Include if Applicable)

Just launch Conan install from CMake:

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
    file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
        "${CMAKE_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)

conan_cmake_run(REQUIRES paho-mqtt-cpp/1.1
    BASIC_SETUP
    BUILD missing)
@isnullxbh isnullxbh added the bug Something isn't working label Dec 3, 2020
@bowb
Copy link
Contributor

bowb commented Dec 14, 2020

I am having the same issue when compiling on armv8

Conan Profile:

[settings]
arch=armv8
arch_build=armv8
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

I am able to work around the issue by doing the following:

run the following command

conan config set general.revisions_enabled=True

In my conanfile.txt I need to specify a specific version of the recipe

paho-mqtt-c/1.3.5@#acc9376a7232c5a50ac898a9131c6c82

It now compiles. Something has changed in the latest recipe that breaks the build.

@bowb
Copy link
Contributor

bowb commented Dec 22, 2020

I am working on a pull request for this issue. It appears that the recipe for paho-mqtt-c/1.3.5 was changed to generated eclipse-paho-mqtt-c instead of PahoMqttC and the cmake files was being incorrectly generated for paho-mqtt-cpp/1.1.

#3974

@voidbar
Copy link
Contributor

voidbar commented Jan 6, 2021

#4096 by @bowb indeed fixes the issue. Just fixed it locally on my machine.

@martinpeniak
Copy link

Hi guys, any idea when I could start using this version please?

paho-mqtt-cpp/1.2.0

I still get:
ERROR: Unable to find 'paho-mqtt-cpp/1.2.0' in remotes

@jayjupdhig
Copy link

Similar problem here:

eclipse-paho/paho.mqtt.c#1059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants