tkn-tub / ns3-gym

ns3-gym - The Playground for Reinforcement Learning in Networking Research
GNU General Public License v2.0
540 stars 199 forks source link

waf build error: ‘zmq::recv_flags’ has not been declared #33

Open bbalaji-ucsd opened 4 years ago

bbalaji-ucsd commented 4 years ago

I hit the following error when I tried to install as per instructions in Readme.

../src/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::Init()’:
../src/opengym/model/opengym_interface.cc:192:36: error: ‘zmq::send_flags’ has not been declared
   m_zmq_socket.send (request, zmq::send_flags::none);
                                    ^~~~~~~~~~
../src/opengym/model/opengym_interface.cc:197:41: error: ‘zmq::recv_flags’ has not been declared
   (void) m_zmq_socket.recv (reply, zmq::recv_flags::none);
                                         ^~~~~~~~~~
../src/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::NotifyCurrentState()’:
../src/opengym/model/opengym_interface.cc:259:36: error: ‘zmq::send_flags’ has not been declared
   m_zmq_socket.send (request, zmq::send_flags::none);
                                    ^~~~~~~~~~
../src/opengym/model/opengym_interface.cc:264:41: error: ‘zmq::recv_flags’ has not been declared
   (void) m_zmq_socket.recv (reply, zmq::recv_flags::none);
                                         ^~~~~~~~~~
pgawlowicz commented 4 years ago

can you check which zmq version do you have installed? probably you will need to update it

bbalaji-ucsd commented 4 years ago

Current libzmq version is 4.3.2 Current pyzmq version is 19.0.1

Seems to be the latest version?

Forsworns commented 4 years ago

Current libzmq version is 4.3.2 Current pyzmq version is 19.0.1 Seems to be the latest version?

I encountered a similar problem as you, see the 32nd issue.

How do you installed the libzmq5-dev? I cannot find this package on Ubuntu16.04... I used sudo apt-get install libzmq5-dev and only got libzmq3-dev. For me, I think maybe the problem comes from the libzmq3-dev.

pgawlowicz commented 4 years ago

Can you revert the last commit, where I applied a pull request to replace deprecated functions of zmq and check? Probably I will need to handle zmq versions in some way.

Forsworns commented 4 years ago

Yep, I revert that commit and related errors disappear. The flag parameter is still optional in my zmq...


I work on Ubuntu 16.04, here are my zmq versions.

libzmq3-dev is already the newest version (4.1.4-7).
libzmq5 is already the newest version (4.1.4-7).

I mentioned that the libzm5-dev is missing in the default apt source. The apt automatically recommend libzmq3-dev and it works well now.

bbalaji-ucsd commented 4 years ago

Thank you! That error was resolved.

I ran into a protobuf version error now. Which version of protobuf should I be using?

../src/opengym/model/opengym_interface.cc:258:69: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations]
   envStateMsg.SerializeToArray(request.data(), envStateMsg.ByteSize());
                                                                     ^
In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0,
                 from /usr/local/include/google/protobuf/map.h:49,
                 from /usr/local/include/google/protobuf/generated_message_table_driven.h:34,
                 from ../src/opengym/model/messages.pb.h:26,
                 from ../src/opengym/model/container.h:27,
                 from ../src/opengym/model/opengym_interface.cc:29:
/usr/local/include/google/protobuf/message_lite.h:408:7: note: declared here
   int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); }
       ^~~~~~~~
cc1plus: all warnings being treated as errors
bbalaji-ucsd commented 4 years ago

Oh never mind the above. I saw the correct version is 3.6.1 from readme. It works now with the previous commit, thank you!

HyungjunJu commented 4 years ago

I'm suffering the same issue as you. Can you explain how the solved zmq version issue?

HyungjunJu commented 4 years ago

I'm suffering the same issue as you. Can you explain how the solved zmq version issue?

I found that using the newest version of zmq (4.2.5) will occur the error. So I did downgrade the zmq(4.1.4) and it works now.

mostafa-shaheen commented 4 years ago

I'm suffering the same issue as you. Can you explain how the solved zmq version issue?

I found that using the newest version of zmq (4.2.5) will occur the error. So I did downgrade the zmq(4.1.4) and it works now.

How did you downgrade to zmq 4.1.4 ?

HyungjunJu commented 4 years ago

Hello Mostafa Shahin,

I removed zmq manually, likewise sudo apt remove zmq. and download specific version of zmq in below site. https://github.com/zeromq/zeromq4-1/releases Install libzmq 4.1.4 by source codes. e.g.) tar xvf zeromq-4.1.4.tar.gz cd zeromq-4.1.4/ sudo ./configure sudo make install

2020년 10월 10일 (토) 오후 8:57, Mostafa Shahin notifications@github.com님이 작성:

I'm suffering the same issue as you. Can you explain how the solved zmq version issue?

I found that using the newest version of zmq (4.2.5) will occur the error. So I did downgrade the zmq(4.1.4) and it works now.

How did you downgrade to zmq 4.1.4 ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tkn-tub/ns3-gym/issues/33#issuecomment-706537874, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQGNUYIGR2SS7BIQ6W5IPLSKBD4PANCNFSM4OE6WGSA .

testMonkey02 commented 4 years ago

I build ns3-gym successfully on Ubuntu20.04 with libzmq 4.3.2; but on Ubuntu18.04 with libzmq 4.2.5, I failed, the error is same as the above. why? i didn't find where is the source of zmq::send_flags or zmq::recv_flags both on two systems.

../src/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::Init()’: ../src/opengym/model/opengym_interface.cc:192:36: error: ‘zmq::send_flags’ has not been declared m_zmq_socket.send (request, zmq::send_flags::none); ^~~~~~ ../src/opengym/model/opengym_interface.cc:197:41: error: ‘zmq::recv_flags’ has not been declared (void) m_zmq_socket.recv (reply, zmq::recv_flags::none); ^~~~~~ ../src/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::NotifyCurrentState()’: ../src/opengym/model/opengym_interface.cc:259:36: error: ‘zmq::send_flags’ has not been declared m_zmq_socket.send (request, zmq::send_flags::none); ^~~~~~ ../src/opengym/model/opengym_interface.cc:264:41: error: ‘zmq::recv_flags’ has not been declared (void) m_zmq_socket.recv (reply, zmq::recv_flags::none);

Zdarling commented 4 years ago

I encountered the same problem. After manually downgrading libzmq to 4.14, the compiler still found an error and indicated that it was missing zmq.hpp File, manual download zmq.hpp File, put into / usr / include, rebuild, and use it successfully

testMonkey02 commented 4 years ago

I encountered the same problem. After manually downgrading libzmq to 4.14, the compiler still found an error and indicated that it was missing zmq.hpp File, manual download zmq.hpp File, put into / usr / include, rebuild, and use it successfully

haha! I tried libzmq 4.14 but found an error that no zmq.hpp, too. Now I update my ubuntu 18.04 to 20.04 and all is settled. Maybe next time if I find a similar error, I will try your method. Thanks!

wanghelong666 commented 3 years ago

../src/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::NotifyCurrentState()’: ../src/opengym/model/opengym_interface.cc:259:36: error: ‘zmq::send_flags’ has not been declared m_zmq_socket.send (request, zmq::send_flags::none); ^~~~~~ ../src/opengym/model/opengym_interface.cc:264:41: error: ‘zmq::recv_flags’ has not been declared (void) m_zmq_socket.recv (reply, zmq::recv_flags::none); ^~~~~~

Waf: Leaving directory `/home/long/ns3-gym/ns3-gym-master/build' Build failed -> task in 'ns3-opengym' failed with exit status 1 (run with -v to display more information) Makefile:4: recipe for target 'all' failed make: *** [all] Error 1 how to solve it?? thank you.

LiYufengzz commented 3 years ago

I encountered the same problem. After manually downgrading libzmq to 4.14, the compiler still found an error and indicated that it was missing zmq.hpp File, manual download zmq.hpp File, put into / usr / include, rebuild, and use it successfully

where did you download zmq.hpp file ? I download and put into /usr/include,but some other errors occurred.It seems that send and recv function have changed with zmq.hpp updating.

error: 'send' is deprecated: from 4.3.1, use send taking message_t and send_flags [-Werror,-Wdeprecated-declarations] m_zmq_socket.send (request); error: 'recv' is deprecated: from 4.3.1, use recv taking a reference to message_t and recv_flags [-Werror,-Wdeprecated-declarations] m_zmq_socket.recv (&reply);

wangxn2015 commented 3 years ago

Hi, firstly, thank the author for his great contribution. Secondly, I encountered the same problem-- "zmq::send_flags has not been declared" under ubuntu16.04 using libzmq3-dev=4.1.4-7 and libzmq5=4.1.4-7. Hope someone can help.

confifu commented 3 years ago

The problem is with libzmq version. Ubuntu 18.04 has older version which causes the error, version 20.04 has more recent version that works. A simple solution is to add 20.04 repos by doing this.

sudo apt-add-repository "deb http://in.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse"
sudo apt-add-repository "deb-src http://in.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse"
sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu focal main universe restricted multiverse"
sudo apt-add-repository "deb-src http://archive.ubuntu.com/ubuntu focal restricted universe multiverse main"
sudo apt-get update

This will make sure that you will install the version of libzmq available in 20.04 (focal fossa)