zeromq / libzmq

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

ZMQ compilation failed(-DWITH_OPENPGM=ON) #4745

Open LongJingGit opened 2 months ago

LongJingGit commented 2 months ago

Issue description

I compiled and installed libpgm-5.2.122. By using the pkg-config --modversion libpgm command, I can see that the version of PGM I installed is 5.2.1, which indicates that the installation was successful.

I cloned the ZMQ source code and checked out version 4.3.4. I used the CMakeLists.txt file for the compilation, with the following commands:

cmake .. -DWITH_OPENPGM=ON -DOPENPGM_PKGCONFIG_NAME=libpgm
make

However, after I executed the make command, I encountered an error. Here is part of the error message:

[ 10%] Building CXX object CMakeFiles/objects.dir/src/mechanism.cpp.o
/usr/bin/c++ -DZMQ_CUSTOM_PLATFORM_HPP -DZMQ_HAVE_OPENPGM -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include/pgm -I/home/ubuntu/libzmq/include -I/home/ubuntu/libzmq/build -std=gnu++11 -Wno-tautological-constant-compare -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/objects.dir/src/mechanism.cpp.o -MF CMakeFiles/objects.dir/src/mechanism.cpp.o.d -o CMakeFiles/objects.dir/src/mechanism.cpp.o -c /home/ubuntu/libzmq/src/mechanism.cpp
In file included from /usr/include/c++/11/chrono:42,
                 from /usr/include/c++/11/condition_variable:38,
                 from /home/ubuntu/libzmq/src/condition_variable.hpp:97,
                 from /home/ubuntu/libzmq/src/mailbox_safe.hpp:43,
                 from /home/ubuntu/libzmq/src/mailbox_safe.cpp:31:
/usr/include/c++/11/ctime:64:11: error: ‘clock’ has not been declared in ‘::’
   64 |   using ::clock;
      |           ^~~~~
/usr/include/c++/11/ctime:65:11: error: ‘difftime’ has not been declared in ‘::’
   65 |   using ::difftime;
      |           ^~~~~~~~
/usr/include/c++/11/ctime:66:11: error: ‘mktime’ has not been declared in ‘::’
   66 |   using ::mktime;
      |           ^~~~~~

Environment

ubuntu20.04(kernel version 6.5.0-1022-aws) zmq4.3.4 libpgm-5.2.122

Minimal test code / Steps to reproduce the issue

What's the actual result? (include assertion message & call stack if applicable)

When i used the cmake .. and make without -DWITH_OPENPGM=ON -DOPENPGM_PKGCONFIG_NAME=libpgm,there were no errors.

I have tried for a long time but have not been able to resolve it

What's the expected result?