我是靠谱客的博主 畅快秋天,最近开发中收集的这篇文章主要介绍ROS-学习笔记-04-( Ubuntu20.04编译ecto,boost1.7环境)Ubuntu20.04编译ecto(boost1.7环境),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

目录

  • Ubuntu20.04编译ecto(boost1.7环境)
    • 编译ecto
        • 简介
        • 1、下载源码安装依赖
        • 2、修改源码
        • Build
        • Install
      • 参考

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/4636 和 boost Revision History ↩︎

最后

以上就是畅快秋天为你收集整理的ROS-学习笔记-04-( Ubuntu20.04编译ecto,boost1.7环境)Ubuntu20.04编译ecto(boost1.7环境)的全部内容,希望文章能够帮你解决ROS-学习笔记-04-( Ubuntu20.04编译ecto,boost1.7环境)Ubuntu20.04编译ecto(boost1.7环境)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(52)

评论列表共有 0 条评论

立即
投稿
返回
顶部