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

Build with PAHO_WITH_MQTT_C is broken #469

Closed
ZaychukAleksey opened this issue Dec 22, 2023 · 5 comments · May be fixed by #471
Closed

Build with PAHO_WITH_MQTT_C is broken #469

ZaychukAleksey opened this issue Dec 22, 2023 · 5 comments · May be fixed by #471
Labels
bug Confirmed bug fix added A fix has been pushed to the repo and is being tested
Milestone

Comments

@ZaychukAleksey
Copy link

git clone --recurse-submodules https://github.com/eclipse/paho.mqtt.cpp.git
cd paho.mqtt.cpp/
cmake -Bbuild -H. -DPAHO_WITH_MQTT_C=ON -DPAHO_BUILD_STATIC=ON -DPAHO_BUILD_DOCUMENTATION=OFF -DPAHO_BUILD_SAMPLES=OFF

yields:

CMake Error at CMakeLists.txt:60 (add_subdirectory):
  add_subdirectory given source
  "/tmp/paho.mqtt.cpp/scr/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.

Which is definitely a bug in CmakeLists since that line should look like this:

add_subdirectory(${PROJECT_SOURCE_DIR}/src/externals/paho-mqtt-c)

But even after fixing the line, the build still fails with:

CMake Error in cmake/CMakeLists.txt:
  export called with target "paho-mqttpp3" which requires target
  "paho-mqtt3as" that is not in any export set.


CMake Error in cmake/CMakeLists.txt:
  export called with target "paho-mqttpp3" which requires target
  "paho-mqtt3as" that is not in any export set.


CMake Error in cmake/CMakeLists.txt:
  export called with target "paho-mqttpp3-static" which requires target
  "paho-mqtt3as" that is not in any export set.
@BillyChen39
Copy link

I can reproduce this error.

CMake Error in cmake/CMakeLists.txt:
  export called with target "paho-mqttpp3" which requires target
  "paho-mqtt3as" that is not in any export set.

But even with this error message, i can still compile the library by running cmake --build build. I'm not sure why this message appears.

@fpagliughi
Copy link
Contributor

Yes, apologies. I should have marked the PAHO_WITH_MQTT_C feature as experimental. It came in as a PR and I didn't fully test it before the release. There is a PR up on the Paho C repo and some updates in the repo here that should get it working better.

@charanhs123
Copy link

Hello , the build error is persistent and the cmake cant be completed

-ThinkPad-T16-Gen-1:~/paho.mqtt.cpp$ cmake -Bbuild -H. -DPAHO_WITH_MQTT_C=ON -DPAHO_BUILD_STATIC=ON -DPAHO_BUILD_DOCUMENTATION=ON -DPAHO_BUILD_SAMPLES=ON
-- Paho C: Bundled
CMake Error at CMakeLists.txt:60 (add_subdirectory):
The source directory

/home/charanhs/paho.mqtt.cpp/src/externals/paho-mqtt-c

does not contain a CMakeLists.txt file.

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.

-- Configuring incomplete, errors occurred!
See also "/home/charanhs/paho.mqtt.cpp/build/CMakeFiles/CMakeOutput.log".

@fpagliughi
Copy link
Contributor

I was waiting for an update to the Paho C library to get the build issues cleaned up, but there hasn't been a release there in a while, so I reworked the build to just work with the existing C v3.1.13.

I think this should all be fixed in master now, though I still need to test on Windows and MacOS. Let me know if you still see a problem.

@fpagliughi fpagliughi added bug Confirmed bug fix added A fix has been pushed to the repo and is being tested labels Jun 15, 2024
@fpagliughi fpagliughi added this to the v1.4 milestone Jun 15, 2024
@fpagliughi
Copy link
Contributor

I believe (hope) this is fixed. If not, please re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug fix added A fix has been pushed to the repo and is being tested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants