zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.75k stars 2.36k forks source link

cmake build error under OSX #4249

Open ClausKlein opened 3 years ago

ClausKlein commented 3 years ago

Please use this template for reporting suspected bugs or requests for help.

Issue description

libzmq/src/wss_engine.hpp:33:10: fatal error: 'gnutls/gnutls.h' file not found

Environment

Minimal test code / Steps to reproduce the issue

bash-3.2$ cd build
bash-3.2$ ninja
[0/1] Re-running CMake...
-- Detected ZMQ Version - 4.3.5
-- Building draft classes and methods
-- Using radix tree implementation to manage subscriptions
-- Enable WebSocket transport
-- Enable WSS transport
-- Checking for module 'libbsd'
--   No package 'libbsd' found
CMake Warning (dev) at /usr/local/Cellar/cmake/3.21.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (sodium)
  does not match the name of the calling package (Sodium).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  builds/cmake/Modules/FindSodium.cmake:42 (find_package_handle_standard_args)
  CMakeLists.txt:266 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Using libsodium for CURVE security
-- Using polling method in I/O threads: kqueue
-- Using polling method in zmq_poll(er)_* API: poll
-- Using 64 bytes alignment for lock-free data structures
-- Using condition_variable_t implementation: stl11
-- Checking whether noexcept is supported
-- Checking whether SOCK_CLOEXEC is supported
-- Checking whether O_CLOEXEC is supported
-- Checking whether SO_BINDTODEVICE is supported
-- Checking whether SO_KEEPALIVE is supported
-- Checking whether SO_PRIORITY is supported
-- Checking whether TCP_KEEPCNT is supported
-- Checking whether TCP_KEEPIDLE is supported
-- Checking whether TCP_KEEPINTVL is supported
-- Checking whether TCP_KEEPALIVE is supported
-- Checking whether TIPC is supported
-- Checking pthread_setname signature
-- Checking pthread_setaffinity signature
-- Checking whether getrandom is supported
CMake Deprecation Warning at tests/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at tests/CMakeLists.txt:310 (message):
  Test 'test_bind_stream_fuzzer' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:310 (message):
  Test 'test_bind_ws_fuzzer' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:310 (message):
  Test 'test_connect_stream_fuzzer' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:310 (message):
  Test 'test_connect_ws_fuzzer' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:310 (message):
  Test 'test_pubsub' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at tests/CMakeLists.txt:310 (message):
  Test 'test_socket_options_fuzzer' is not known to CTest.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at unittests/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/clausklein/Workspace/c/libzmq/build
[3/384] Building CXX object CMakeFiles/objects.dir/src/wss_engine.cpp.o
FAILED: CMakeFiles/objects.dir/src/wss_engine.cpp.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DZMQ_CUSTOM_PLATFORM_HPP -D_DARWIN_C_SOURCE -D_REENTRANT -D_THREAD_SAFE -I/usr/local/Cellar/libsodium/1.0.18_1/include -I/Users/clausklein/Workspace/c/libzmq/include -I/Users/clausklein/Workspace/c/libzmq/build -std=c++11 -Wno-tautological-constant-compare -Wall -Wextra -Wno-long-long -Wno-uninitialized -pedantic -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -fPIC -MD -MT CMakeFiles/objects.dir/src/wss_engine.cpp.o -MF CMakeFiles/objects.dir/src/wss_engine.cpp.o.d -o CMakeFiles/objects.dir/src/wss_engine.cpp.o -c /Users/clausklein/Workspace/c/libzmq/src/wss_engine.cpp
In file included from /Users/clausklein/Workspace/c/libzmq/src/wss_engine.cpp:31:
/Users/clausklein/Workspace/c/libzmq/src/wss_engine.hpp:33:10: fatal error: 'gnutls/gnutls.h' file not found
#include <gnutls/gnutls.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
[6/384] Building CXX object CMakeFiles/objects.dir/src/ws_engine.cpp.o
FAILED: CMakeFiles/objects.dir/src/ws_engine.cpp.o 
ClausKlein commented 3 years ago

see https://github.com/zeromq/libzmq/pull/4250

ZiruiOu commented 3 years ago

Does that mean if I want to correctly compile my libzmq I gotta set the cmake version be to be 3.0.2?

ClausKlein commented 3 years ago

Does that mean if I want to correctly compile my libzmq I gotta set the cmake version be to be 3.0.2?

not yet, but in the future. It is deprecated ...

the current cmake version is https://github.com/Kitware/CMake/releases/tag/v3.21.3

realy modern cmake is starting with with somthink like this:

cmake_minimum_required(VERSION 3.14...3.21)