zeromq / cppzmq

Header-only C++ binding for libzmq
http://www.zeromq.org
MIT License
1.95k stars 757 forks source link

CMake error! message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config") #420

Open dapeng17951 opened 4 years ago

dapeng17951 commented 4 years ago

message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")

sigiesec commented 4 years ago

Thanks for your report.

Note that for using cppzmq, you don't have to build it at all, it is a header only library. You need a libzmq library (static or shared) for your platform, and link it into your application/library, as described with libzmq itself. Then, you only need to #include "zmq.hpp" (and maybe #include "zmq_addon.hpp") to use cppzmq.

If you want to develop cppzmq itself and run its tests, please provide details on your environment, in particular the OS, how/where you installed libzmq, and how you ran cmake.

Miosss commented 4 years ago

@sigiesec So what exactly is cmake for in this project? I tried building it (with similar error) and then just included it and voila, it works. What do I miss by not building it?

f3rm4rf3r commented 4 years ago

Thanks for your report.

Note that for using cppzmq, you don't have to build it at all, it is a header only library. You need a libzmq library (static or shared) for your platform, and link it into your application/library, as described with libzmq itself. Then, you only need to #include "zmq.hpp" (and maybe #include "zmq_addon.hpp") to use cppzmq.

If you want to develop cppzmq itself and run its tests, please provide details on your environment, in particular the OS, how/where you installed libzmq, and how you ran cmake.

Could you explain then why this is in the README? I am having also build failures with gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 and libzmq 4.2.5-1ubuntu0.2

Schamschula commented 4 years ago

I have been trying to get past this one as well. While configuring xeus-sqlite I get the following error:

-- Building xeus-sqlite v0.. -- Found nlohmann_json: /opt/local/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.7.3", minimum required is "3.2.0") -- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2") -- Checking for module 'libzmq' -- Found libzmq, version 4.3.2 CMake Error at /opt/local/share/cmake/cppzmq/cppzmqConfig.cmake:53 (message): ZeroMQ was NOT found! Call Stack (most recent call first): /opt/local/share/cmake-3.17/Modules/CMakeFindDependencyMacro.cmake:47 (find_package) /opt/local/lib/cmake/xeus/xeusConfig.cmake:64 (find_dependency) CMakeLists.txt:62 (find_package)

-- Configuring incomplete, errors occurred!

Unfortunately, xeus and zeus-sqilte need the cppzmqConfig.cmake file, but my platform macOS/MacPorts currently provides the autotools version of zmq. I've found no way to work around it. Changing to the cmake version of zmq changes both the current and compatibility version of the zmq library (to a smaller number in both cases), which means rebuilding all dependent ports.