ROS-学习笔记-04-( Ubuntu20.04编译ecto,boost1.7环境)

Ubuntu20.04编译ecto(boost1.7环境)

编译ecto

简介

Ecto is a hybrid C++/Python development framework for constructing and maintaining pipelines. In Ecto, pipelines are constructed in terms of processing units, Cells, connected by data paths, Tendrils, that form Directed Acyclic Graphs, Plasms. Cells are typically written in C++, tendrils may be any type, and the plasm may be executed in a variety of clever ways. Python is uses as a the graph DSL.

Ecto may be found useful in domains such as perception, audio, or robotics.

To get started see the online docs at http://plasmodic.github.io/ecto/

1、下载源码安装依赖

前提是已经安装了boost和catkin,安装boost见后文,catkin按理说应该在安装ros时就装好了sudo apt install catkin 如果有依赖冲突可以用aptitude解决。
下载源直接从github拉取。1

mkdir catkin_workspace/ catkin_workspace/src
cd catkin_workspace/src
git clone http://github.com/plasmodic/ecto.git

其他依赖:

sudo apt-get install libboost-python-dev libboost-filesystem-dev libboost-system-dev \
    libboost-thread-dev python-setuptools python-gobject python-gtk2 graphviz doxygen \
    python-sphinx
# For catkin and it’s tools :
sudo apt-get install python-catkin-pkg ros-noetic-catkin
2、修改源码

由于编译时会报错

fatal error: boost/tr1/unordered_map.hpp: 没有那个文件或目录
32 | #include <boost/tr1/unordered_map.hpp>

需要修改源码,出错文件分别是:ecto/src/lib/util.cppecto/src/lib/plasm/impl.hpp,更改时去掉目录中的tr1,改为:#include <boost/unordered_map.hpp>
同时还要修改util.cpp中对应命名空间也要改掉:2

typedef std::tr1::unordered_map<std::string, std::string> dict_t; // 修改前
typedef boost::unordered_map<std::string, std::string> dict_t; // 修改后

以上问题其实再melodic版本也会遇到,除了这个错误以外, 还需要修改ecto/src/lib/strand.cpp,否则会报出如下错误:

error: ‘class boost::asio::io_context::strand’ has no member named ‘get_io_service’

修改第95行的代码:

 boost::asio::io_service& serv_inside_strand = thestrand->get_io_service(); //改前
 boost::asio::io_context& serv_inside_strand = thestrand->context() ;  //改后

The previously deprecated get_io_context and get_io_service member functions have now been removed.3
也就是需要把‘io_service’改为‘io_context’,然后‘get_io_service’改为‘context’

最后是这个错误,参考:https://github.com/opencog/opencog/issues/48#issuecomment-19075662
https://github.com/nvdla/hw/issues/185

/ecto/include/ecto/python/streambuf.hpp:297:11: error: ‘PyString_AsStringAndSize’ was not declared in this scope; did you mean ‘PyBytes_AsStringAndSize’?

PyString_AsStringAndSize改为PyBytes_AsStringAndSize

如果还有其他问题,有可能是在虚拟机挂载时,在windows挂在目录下编译,这是不可行的。但也可以参考这篇解决方案 : failed to create symbolic link ‘libavutil.so’:

如果还是有连接问题如下:

libecto.so.0.6.12: undefined reference to `boost::re_detail_107400::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()' /usr/bin/ld: /home/jillian/ROS/cat/devel/lib/libecto.so.0.6.12: undefined reference to `boost::re_detail_107400::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<c

则有可能是boost版本问题,有可能一台机器上安装多个boost版本,卸载删除其中一个即可。

如果你使用的是1.74而非1.71的boost,还可能遇到如下问题:

/home/jillian/ROS/cat/src/ecto/samples/experimental/necto.cpp: In
constructor ‘ecto_X::server::server(boost::asio::io_service&, short
unsigned int)’:
/home/jillian/ROS/cat/src/ecto/samples/experimental/necto.cpp:247:56:
error: ‘boost::asio::ip::tcp::acceptor’ {aka ‘class
boost::asio::basic_socket_acceptorboost::asio::ip::tcp’} has no
member named ‘get_io_service’ 247 | connection_ptr
new_conn(new connection(acceptor_.get_io_service()));
|
^~~~~~~~~~~~~~

和上方相似,·修改文件/ecto/samples/experimental/necto.cpp第265行。

connection_ptr new_conn(new connection(acceptor_.get_io_service()));
connection_ptr new_conn(new connection(acceptor_.context()));
Build
catkin_make
catkin_install

还有就是catkin_make无法编译的话,可以选择用cmake:

cd ecto
mkdir -p build
cd build
cmake ..
make
Install

catkin编译的话可以将install目录下的文件复制,或者连接到系统中。
如果是cmake编译:

cd ecto/build
make install

参考


  1. plasmodic/ecto ↩︎

  2. ROS-Melodic版编译安装ecto ↩︎

  3. github:issues/4636boost Revision History ↩︎

  • 2
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

canmoumou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值