最近在安装FastDDS,按照官网教程以为很简单,结果却踩了不少的坑,记一下,其中有一些问题在ROS1、ROS2以及Micro-ROS中都有出现,可以作为一些参考。
问题一:’vcs’ not found
问题表现
问题解决
官方的教程问题,pip3 install -U colcon-common-extensions vcstool
命令前加上sudo
。否则安装的东西不会加到路径中
问题二:pytest版本不对
问题表现
问题解决
运行命令强制安装一下
sudo pip3 install pytest-rerunfailures
如果这一步忽略了,那么下面问题四就会出现。再安装也不晚。
问题三:vcs import src < fastrtps.repos 很慢、并且失败
主要原因是因为懂得都懂的存在,但问题就在于你打开了小飞机都没有用。
问题表现
在执行了命令vcs import src < fastrtps.repos
后,会出现若干个E,以及红字报错,如图所示。
问题分析与解决
vcs命令是一个版本控制命令,这句命令的主要功能是把fastrtps.repos中记录的一些命令进行执行,并将获得的文件放入src文件中。
我们打开fastrtps.repos,可以发现里面的内容如下所示:
1 | repositories: |
其本质就是创建一个文件夹,然后使用git clone命令,将url中的东西下载到这个文件夹,五个部分分别下载五个文件夹。报错信息中E的数量和该文件中的部分数目是对应的。
所以本质是github的问题,仓库在墙外,所以导致访问超时失败。
当然有很多解决办法,个人觉得百分百成功的应该就是翻墙大法。但是VPN开启后还是相同的问题,主要是因为git没有走代理的端口,所以我们应该设置一下git走代理端口。
一般我们使用的翻墙工具是ss嘛,是基于socks协议的,所以我们需要这两个命令行:
1 | git config --global http.proxy 'socks5://127.0.0.1:1080' |
然后再执行一遍(记得打开小飞机)vcs import src < fastrtps.repos
显然已经有四个成功了!没成功那个我感觉可能是因为第三个、第四个都是往目录fastrtpsgen中git东西,然后可能它是先有thirdparty这个文件夹,所以因为fastrtpsgen路径非空的原因,导致git失败。事实上后来发现这种问题是小概率时间,大概率是一遍成功的。看一下此时fastrtpsgen的目录结构
果然只有第五部分git成功了。我的解决方案是删掉fasrtrtpsgen,然后重新执行vcs import src < fastrtps.repos
,这次就会比较快,因为很多已经git过了,没再报错。
重新看一下fastrtpsgen的目录结构,没有问题。
当然这部分具体原因应该涉及vcs对repo进行解释的具体过程,我还不甚清楚。后面我会再调查一下。
对了,最后记得把git代理关掉,否则访问国内资源会很慢,以及万一vpn没关就会啥都访问不到。关闭命令是
1 | git config --global --unset http.proxy |
问题四:colcon build失败(如果问题二解决了这个问题不会再发生)
主要问题是依赖问题,pytest下载的版本问题。
问题表现
上一步安装完毕后,进入src目录,执行colcon build命令,colcon是基于CMake的工具,是用来构建软件包的,也是ROS2开发工具。本来以为前面按照教程装好了依赖应该没问题了,结果还是发生了报错,报错很长,但是都差不多,截取一部分放在下面:
·········
ERROR:colcon.colconcore.entrypoint:Exception loading extension ‘colconcore.environmentvariable.allshells’: (pytest 4.6.9 (/usr/lib/python3/dist-packages), Requirement.parse(‘pytest>=5.0’), {‘pytest-rerunfailures’})
Traceback (most recent call last):
File “/home/wzj/.local/lib/python3.8/site-packages/colconcore/entry_point.py”, line 120, in load_entry_points
extension_type = load_entry_point(entry_point)
File “/home/wzj/.local/lib/python3.8/site-packages/colcon_core/entry_point.py”, line 168, in load_entry_point
return entry_point.load()
File “/usr/lib/python3/dist-packages/pkg_resources/__init\.py”, line 2444, in load
self.require(args, *kwargs)
File “/usr/lib/python3/dist-packages/pkg_resources/__init\.py”, line 2467, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File “/usr/lib/python3/dist-packages/pkg_resources/__init\.py”, line 792, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pytest 4.6.9 (/usr/lib/python3/dist-packages), Requirement.parse(‘pytest>=5.0’), {‘pytest-rerunfailures’})·········
问题分析与解决
一看就知道是pytest版本没跟上,虽然不知道啥原因,但是不妨碍我重新安装一下试试。执行命令sudo pip(pip3) install pytest-rerunfailures
(ps. 网上抄的)
虽然有一大堆can't uninstall XXX.No files were fount to uninstall
但是最后看到了Successfully installed iniconfig-1.1.1 py-1.10.0 pytest-6.2.3 toml-0.10.2
,说明缺少的pytest高版本已经有了,
重新执行colcon build
就开始跑了。
问题五:colcon build失败(二)
问题表现
东西挺多,我直接贴log
Cloning into ‘foo_mem-ext’…
Note: switching to ‘c619113’.You are in ‘detached HEAD’ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:git switch -c
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at c619113 Whitespace clean up (#70)
Submodule ‘cmake/comp’ (https://github.com/foonathan/compatibility.git) registered for path ‘cmake/comp’
Cloning into ‘/home/wzj/Fast-DDS/build/foonathan_memory_vendor/foo_mem-ext-prefix/src/foo_mem-ext/cmake/comp’…
CMake Error at cmake/comp/comp_base.cmake:288 (message):
error downloading feature file cpp11_lang/constexpr.cmake: “Failure when
receiving data from the peer”. Check spelling of feature.Trying 185.199.108.133:443...
TCP_NODELAY set
connect to 185.199.108.133 port 443 failed: Connection refused
Trying 185.199.109.133:443...
TCP_NODELAY set
connect to 185.199.109.133 port 443 failed: Connection refused
Trying 185.199.110.133:443...
TCP_NODELAY set
Connected to raw.githubusercontent.com (185.199.110.133) port 443 (#0)
ALPN, offering h2
ALPN, offering http/1.1
successfully set certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs
[5 bytes data]
TLSv1.3 (OUT), TLS handshake, Client hello (1):
[512 bytes data]
[5 bytes data]
TLSv1.3 (IN), TLS handshake, Server hello (2):
[122 bytes data]
[5 bytes data]
[5 bytes data]
[1 bytes data]
TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
[19 bytes data]
[5 bytes data]
[1 bytes data]
TLSv1.3 (IN), TLS handshake, Certificate (11):
[3067 bytes data]
[5 bytes data]
[1 bytes data]
TLSv1.3 (IN), TLS handshake, CERT verify (15):
[264 bytes data]
[5 bytes data]
[1 bytes data]
TLSv1.3 (IN), TLS handshake, Finished (20):
[52 bytes data]
[5 bytes data]
TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
[1 bytes data]
[5 bytes data]
[1 bytes data]
TLSv1.3 (OUT), TLS handshake, Finished (20):
[52 bytes data]
SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
ALPN, server accepted to use h2
Server certificate:
subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=www.github.com
start date: May 6 00:00:00 2020 GMT
expire date: Apr 14 12:00:00 2022 GMT
subjectAltName: host “raw.githubusercontent.com” matched cert’s “*.githubusercontent.com”
issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
SSL certificate verify ok.Using HTTP2, server supports multi-use
Connection state changed (HTTP/2 confirmed)
Copying HTTP/2 data in stream buffer to connection buffer after upgrade:
len=0[5 bytes data]
[1 bytes data]
[5 bytes data]
[1 bytes data]
[5 bytes data]
[1 bytes data]
Using Stream ID: 1 (easy handle 0x5575f191ae80)
[5 bytes data]
[1 bytes data]
GET /foonathan/compatibility/master/cpp11_lang/constexpr.cmake HTTP/2
Host: raw.githubusercontent.com
user-agent: curl/7.66.0
accept: /
[5 bytes data]
[1 bytes data]
TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
[193 bytes data]
OpenSSL SSL_read: Connection reset by peer, errno 104
Failed receiving HTTP2 data
[5 bytes data]
[1 bytes data]
OpenSSL SSL_write: Broken pipe, errno 32
Failed sending HTTP2 data
Connection #0 to host raw.githubusercontent.com left intact
Call Stack (most recent call first):
cmake/comp/comp_base.cmake:347 (_comp_fetch_feature)
cmake/comp/comp_base.cmake:369 (_comp_handle_feature)
cmake/compatibility.cmake:13 (comp_target_features)
CMakeLists.txt:50 (include)make[2]: [CMakeFiles/foo_mem-ext.dir/build.make:108: foo_mem-ext-prefix/src/foo_mem-ext-stamp/foo_mem-ext-configure] Error 1
make[1]: [CMakeFiles/Makefile2:76: CMakeFiles/foo_mem-ext.dir/all] Error 2
make: * [Makefile:130: all] Error 2
问题分析和解决
中间的几次try是我将raw.githubusercontent.com域名解析出来的四个ip写到了/etc/hosts里,显然在尝试185.199.110.133的时候应该成功了,并且已经有了一部分数据交换,但是在后来http2 data的接受时候又失败了。
解决办法目前是没有很好的解决办法,运气好的话换网络,用手机热点有一定几率成功(???经典ROS),至于原因还不清楚。
····
在github上提了issue,大佬给了回复,但是还没有解决我的问题,哎。
·····
已经在看计算机网络了,辣鸡gayhub。
原文链接: https://zijian.wang/2021/04/12/安装fastDDS中遇到的问题/
版权声明: 转载请注明出处.