eclipse-paho / paho.mqtt.cpp

Other
1.03k stars 438 forks source link

Wrong target link libraries names for static libs, which breaks configure #515

Open barracuda156 opened 1 month ago

barracuda156 commented 1 month ago

If I enable static and dynamic libs both, configure fails:

--->  Configuring paho.mqtt.cpp
        (using ccache)
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_paho.mqtt.cpp/paho.mqtt.cpp/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DPAHO_BUILD_SHARED=ON -DPAHO_BUILD_STATIC=ON -DPAHO_WITH_SSL=ON -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="ppc" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.6" -DCMAKE_OSX_SYSROOT="/" /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_paho.mqtt.cpp/paho.mqtt.cpp/work/paho.mqtt.cpp-1.4.1 
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/gcc-mp-14 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/local/bin/g++-mp-14 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /opt/local/libexec/openssl3/lib/libcrypto.dylib (found version "3.3.2")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (9.4s)
CMake Error at src/CMakeLists.txt:82 (target_link_libraries):
  Target "paho-mqttpp3-static" links to:

    eclipse-paho-mqtt-c::paho-mqtt3as-static

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

-- Generating done (0.1s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_OBJCXX_COMPILER
    CMAKE_OBJC_COMPILER
    CMAKE_POLICY_DEFAULT_CMP0025
    CMAKE_POLICY_DEFAULT_CMP0060
    WITH_SSL

CMake Generate step failed.  Build files cannot be regenerated correctly.

Looks like target link libraries names are wrong. What is actually installed by paho.mqtt.c:

36-202% port contents paho.mqtt.c
Port paho.mqtt.c @1.3.13_1 contains:
  /opt/local/bin/MQTTVersion
  /opt/local/include/MQTTAsync.h
  /opt/local/include/MQTTClient.h
  /opt/local/include/MQTTClientPersistence.h
  /opt/local/include/MQTTExportDeclarations.h
  /opt/local/include/MQTTProperties.h
  /opt/local/include/MQTTReasonCodes.h
  /opt/local/include/MQTTSubscribeOpts.h
  /opt/local/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfig-macports.cmake
  /opt/local/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfig.cmake
  /opt/local/lib/cmake/eclipse-paho-mqtt-c/eclipse-paho-mqtt-cConfigVersion.cmake
  /opt/local/lib/libpaho-mqtt3a.1.3.13.dylib
  /opt/local/lib/libpaho-mqtt3a.1.dylib
  /opt/local/lib/libpaho-mqtt3a.a
  /opt/local/lib/libpaho-mqtt3a.dylib
  /opt/local/lib/libpaho-mqtt3as.1.3.13.dylib
  /opt/local/lib/libpaho-mqtt3as.1.dylib
  /opt/local/lib/libpaho-mqtt3as.a
  /opt/local/lib/libpaho-mqtt3as.dylib
  /opt/local/lib/libpaho-mqtt3c.1.3.13.dylib
  /opt/local/lib/libpaho-mqtt3c.1.dylib
  /opt/local/lib/libpaho-mqtt3c.a
  /opt/local/lib/libpaho-mqtt3c.dylib
  /opt/local/lib/libpaho-mqtt3cs.1.3.13.dylib
  /opt/local/lib/libpaho-mqtt3cs.1.dylib
  /opt/local/lib/libpaho-mqtt3cs.a
  /opt/local/lib/libpaho-mqtt3cs.dylib
  /opt/local/share/doc/Eclipse Paho C/CONTRIBUTING.md
  /opt/local/share/doc/Eclipse Paho C/README.md
  /opt/local/share/doc/Eclipse Paho C/edl-v10
  /opt/local/share/doc/Eclipse Paho C/epl-v20
  /opt/local/share/doc/Eclipse Paho C/notice.html
  /opt/local/share/doc/Eclipse Paho C/samples/MQTTAsync_publish.c
  /opt/local/share/doc/Eclipse Paho C/samples/MQTTAsync_publish_time.c
  /opt/local/share/doc/Eclipse Paho C/samples/MQTTAsync_subscribe.c
  /opt/local/share/doc/Eclipse Paho C/samples/MQTTClient_publish.c
  /opt/local/share/doc/Eclipse Paho C/samples/MQTTClient_publish_async.c
  /opt/local/share/doc/Eclipse Paho C/samples/MQTTClient_subscribe.c
  /opt/local/share/doc/Eclipse Paho C/samples/paho_c_pub.c
  /opt/local/share/doc/Eclipse Paho C/samples/paho_c_sub.c
  /opt/local/share/doc/Eclipse Paho C/samples/paho_cs_pub.c
  /opt/local/share/doc/Eclipse Paho C/samples/paho_cs_sub.c
  /opt/local/share/doc/Eclipse Paho C/samples/pubsub_opts.c
fpagliughi commented 1 month ago

Yes. This is discussed in #500... here

We're still waiting on a release of the upstream Paho C library for the full fix. Soon, I hope.