1 protobuf-3.6.1 安装
如何编译源码目录下只有configure.ac文件和Makefile.am文件的工程
如果要编译的源码没有configure文件,执行如下命令。在执行过程中遇到缺失依赖包,则用apt-get安装即可。
aclocal
autoconf
autoheader
automake --add-missing
./autogen.sh
./configure --prefix=/usr/local/bin
make
make check
make install
ldconfig
# wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz
#tar zvxf protobuf-all-3.6.1.tar.gz
#cd protobuf-3.6.1
which propoc
protoc --vertion
# 添加环境变量:vim ~/.bashrc
export PATH=/usr/local/protobuf/bin/:$PATH
export PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig/
export LD_LIBRARY_PATH=/usr/local/protobuf/lib:$LD_LIBRARY_PATH
# 测试:
protoc --verison
which protoc
2 zmq-4.1.4 安装
https://m.linuxidc.com/Linux/2017-06/145320.htm
# removed zmq
sudo apt remove zmq
# download specific version of zmq in below site.
# https://github.com/zeromq/zeromq4-1/releases
# Install libzmq 4.1.4 by source codes.
# tar xvf zeromq-4.1.4.tar.gz
cd zeromq-4.1.4/
sudo ./configure
sudo make install
3 问题记录
[1817/1977] Linking build/lib/libns3.29-topology-read-debug.so
In file included from ../contrib/opengym/model/opengym_interface.h:26,
from ../contrib/opengym/model/opengym_interface.cc:27:
/usr/include/zmq.hpp:638:14: error: ‘ZMQ_BLOCKY’ was not declared in this scope; did you mean ‘ZMQ_NOBLOCK’?
638 | blocky = ZMQ_BLOCKY,
| ^~~~~~~~~~
| ZMQ_NOBLOCK
/usr/include/zmq.hpp:642:31: error: ‘ZMQ_THREAD_AFFINITY_CPU_ADD’ was not declared in this scope
642 | thread_affinity_cpu_add = ZMQ_THREAD_AFFINITY_CPU_ADD,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/zmq.hpp:643:34: error: ‘ZMQ_THREAD_AFFINITY_CPU_REMOVE’ was not declared in this scope
643 | thread_affinity_cpu_remove = ZMQ_THREAD_AFFINITY_CPU_REMOVE,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/zmq.hpp:644:26: error: ‘ZMQ_THREAD_NAME_PREFIX’ was not declared in this scope
644 | thread_name_prefix = ZMQ_THREAD_NAME_PREFIX,
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/zmq.hpp:645:17: error: ‘ZMQ_MAX_MSGSZ’ was not declared in this scope; did you mean ‘ZMQ_MAXMSGSIZE’?
645 | max_msgsz = ZMQ_MAX_MSGSZ,
| ^~~~~~~~~~~~~
| ZMQ_MAXMSGSIZE
/usr/include/zmq.hpp:652:18: error: ‘ZMQ_MSG_T_SIZE’ was not declared in this scope
652 | msg_t_size = ZMQ_MSG_T_SIZE
| ^~~~~~~~~~~~~~
../contrib/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::Init()’:
../contrib/opengym/model/opengym_interface.cc:192:29: error: ‘bool zmq::detail::socket_base::send(zmq::message_t&, int)’ is deprecated: from 4.3.1, use send taking message_t and send_flags [-Werror=deprecated-declarations]
192 | m_zmq_socket.send (request);
| ^
In file included from ../contrib/opengym/model/opengym_interface.h:26,
from ../contrib/opengym/model/opengym_interface.cc:27:
/usr/include/zmq.hpp:1326:10: note: declared here
1326 | bool send(message_t &msg_,
| ^~~~
../contrib/opengym/model/opengym_interface.cc:197:28: error: ‘bool zmq::detail::socket_base::recv(zmq::message_t*, int)’ is deprecated: from 4.3.1, use recv taking a reference to message_t and recv_flags [-Werror=deprecated-declarations]
197 | m_zmq_socket.recv (&reply);
| ^
In file included from ../contrib/opengym/model/opengym_interface.h:26,
from ../contrib/opengym/model/opengym_interface.cc:27:
/usr/include/zmq.hpp:1407:10: note: declared here
1407 | bool recv(message_t *msg_, int flags_ = 0)
| ^~~~
../contrib/opengym/model/opengym_interface.cc: In member function ‘void ns3::OpenGymInterface::NotifyCurrentState()’:
../contrib/opengym/model/opengym_interface.cc:259:29: error: ‘bool zmq::detail::socket_base::send(zmq::message_t&, int)’ is deprecated: from 4.3.1, use send taking message_t and send_flags [-Werror=deprecated-declarations]
259 | m_zmq_socket.send (request);
| ^
In file included from ../contrib/opengym/model/opengym_interface.h:26,
from ../contrib/opengym/model/opengym_interface.cc:27:
/usr/include/zmq.hpp:1326:10: note: declared here
1326 | bool send(message_t &msg_,
| ^~~~
../contrib/opengym/model/opengym_interface.cc:264:28: error: ‘bool zmq::detail::socket_base::recv(zmq::message_t*, int)’ is deprecated: from 4.3.1, use recv taking a reference to message_t and recv_flags [-Werror=deprecated-declarations]
264 | m_zmq_socket.recv (&reply);
| ^
In file included from ../contrib/opengym/model/opengym_interface.h:26,
from ../contrib/opengym/model/opengym_interface.cc:27:
/usr/include/zmq.hpp:1407:10: note: declared here
1407 | bool recv(message_t *msg_, int flags_ = 0)
| ^~~~
cc1plus: all warnings being treated as errors
In file included from ../contrib/opengym/model/opengym_interface.h:26,
from ../contrib/opengym/model/opengym_env.cc:27:
/usr/include/zmq.hpp:638:14: error: ‘ZMQ_BLOCKY’ was not declared in this scope; did you mean ‘ZMQ_NOBLOCK’?
638 | blocky = ZMQ_BLOCKY,
| ^~~~~~~~~~
| ZMQ_NOBLOCK
/usr/include/zmq.hpp:642:31: error: ‘ZMQ_THREAD_AFFINITY_CPU_ADD’ was not declared in this scope
642 | thread_affinity_cpu_add = ZMQ_THREAD_AFFINITY_CPU_ADD,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/zmq.hpp:643:34: error: ‘ZMQ_THREAD_AFFINITY_CPU_REMOVE’ was not declared in this scope
643 | thread_affinity_cpu_remove = ZMQ_THREAD_AFFINITY_CPU_REMOVE,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/zmq.hpp:644:26: error: ‘ZMQ_THREAD_NAME_PREFIX’ was not declared in this scope
644 | thread_name_prefix = ZMQ_THREAD_NAME_PREFIX,
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/zmq.hpp:645:17: error: ‘ZMQ_MAX_MSGSZ’ was not declared in this scope; did you mean ‘ZMQ_MAXMSGSIZE’?
645 | max_msgsz = ZMQ_MAX_MSGSZ,
| ^~~~~~~~~~~~~
| ZMQ_MAXMSGSIZE
/usr/include/zmq.hpp:652:18: error: ‘ZMQ_MSG_T_SIZE’ was not declared in this scope
652 | msg_t_size = ZMQ_MSG_T_SIZE
| ^~~~~~~~~~~~~~
Waf: Leaving directory `/home/jnbai/ns3.29-gym/ns-allinone-3.29/ns-3.29/build'
Build failed
-> task in 'ns3-opengym' failed with exit status 1 (run with -v to display more information)
-> task in 'ns3-opengym' failed with exit status 1 (run with -v to display more information)
关于protobuf问题:https://github.com/tkn-tub/ns3-gym/issues/16
protoc --version
# libprotoc 3.0.0
pip3 show protobuf
# Name: protobuf
# Version: 3.9.0
# Summary: Protocol Buffers
# 以下卸载高版本protobuf,安装3.9.0版本:
pip3 uninstall protobuf
apt-get remove libprotobuf-dev
pip3 install protobuf==3.9.0
# 注:不要执行下面两句(会升级protobuf)
sudo add-apt-repository ppa:maarten-fonville/protobuf
sudo apt-get update
caffe ubuntu 安装报 google::protobuf 链接失败问题
- 运行./waf --run RL-TCP,显示以下内容:
[libprotobuf FATAL ./google/protobuf/repeated_field.h:1453] CHECK failed: (n) >= (0):
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: (n) >= (0):
解决:
pip3 uninstall protobuf
apt-get remove libprotobuf-dev
pip3 install protobuf==3.9.0
./waf configure
./waf