catkin_make失败(编译am_traj)

am_traj源码:https://github.com/ZJU-FAST-Lab/am_traj

记住sudo gedit ~/.bashrc时,source /opt/ros/kinetic/setup.bash要放在最后3行以内才有效,最后source ~/.bashrc

错误一: Could neither find file “toplevel.cmake”

~/catkin_ws$ catkin_make
Base path: /home/ycx/catkin_ws
Source space: /home/ycx/catkin_ws/src
Build space: /home/ycx/catkin_ws/build
Devel space: /home/ycx/catkin_ws/devel
Install space: /home/ycx/catkin_ws/install
Creating the toplevel cmake file failed: Could neither find file "toplevel.cmake" in any workspace nor relative, checked the following paths:
/home/ycx/catkin_ws/src/catkin/cmake/toplevel.cmake
/opt/ros/kinetic/catkin/cmake/toplevel.cmake
/usr/local/lib/python2.7/dist-packages/cmake/toplevel.cmake
/usr/local/lib/share/catkin/cmake/toplevel.cmake
/usr/local/lib/python2.7/share/catkin/cmake/toplevel.cmake

参考https://blog.csdn.net/qq_44896337/article/details/104184386

sudo mv share /usr/local/lib/

错误二:Could not find CMAKE_ROOT

####
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.14
CMake Error: Error executing cmake::LoadCache(). Aborting.

参考https://blog.csdn.net/caicaiatnbu/article/details/87983234
重新编译,压缩包放置在 /usr/local/ 目录下,解压

sudo chmod +777 local//这一步可能有问题,最好用sudo复制、解压、改名
//改成cmake
sudo ./bootstrap –prefix=/usr
sudo make 
sudo make install
cmake –version
//cmake –V

此时,我发现cmake –version失效了,莫慌,先看看cmake能不能用,我还是能用的(于是就不管了)
在意识到cmake其实能用之前,也做了许多“无用功”,也一起放上来吧。
sudo ln -s /usr/local/bin/cmake /usr/bin/
sudo rm /usr/bin/cmake
1、 /etc/profile
export “CMAKE_ROOT=/usr/local/bin/cmake”,cmake路径根据自己的修改
sudo vim /etc/profile
export CMAKE_ROOT=/usr/local/bin/cmake,cmake路径根据自己的修改
2、 source /etc/profile 执行这个命令
参考,其实对我没效果
https://blog.csdn.net/lixiaogang_theanswer/article/details/73693004?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

错误三: NOT find Armadillo

接下来的错误可能是编译example1错误引起的,可以先删example1,就编example0.
之后可以按github步骤(我当时又没意识到,花了很多时间,卡在%97,最后还是删了example1…)

CMake Error at /usr/local/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Armadillo (missing: ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR)
Call Stack (most recent call first):
sudo apt install Armadillo*
sudo apt install ompl*//其实应该不用,github里会教你做的

错误四(example1错误):pcl_conversions.h: 没有那个文件或目录

此时应该删掉example1的,但我没意识到

/catkin_ws/src/am_traj-master/example1/env/map_server/map_generator/src/random_complex_generator.cpp:3:45: fatal error: pcl_conversions/pcl_conversions.h: 没有那个文件或目录
sudo apt-get install ros-kinetic-navigation

参考https://blog.csdn.net/subiluo/article/details/86251734

错误五(example1错误): g+±7: not found

此时应该删掉example1的,但我没意识到,看了还久才知道是版本问题,github后面也有装g+±7步骤,但步骤貌似不全

/bin/sh: 1: g++-7: not found
am_traj-master/example1/env/state_machine/CMakeFiles/state_machine.dir/build.make:62: recipe for target 'am_traj-master/example1/env/state_machine/CMakeFiles/state_machine.dir/src/dataio.cpp.o' failed
make[2]: *** [am_traj-master/example1/env/state_machine/CMakeFiles/state_machine.dir/src/dataio.cpp.o] Error 127
CMakeFiles/Makefile2:3903: recipe for target 'am_traj-master/example1/env/state_machine/CMakeFiles/state_machine.dir/all' failed
make[1]: *** [am_traj-master/example1/env/state_machine/CMakeFiles/state_machine.dir/all] Error 2
make[1]: *** 正在等待未完成的任务.…

更新源,完了在改回来

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-7

在这里插入图片描述
参考https://blog.csdn.net/YuYunTan/article/details/84205462?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522159185387119195239807742%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=159185387119195239807742&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allbaidu_landing_v2~default-1-84205462.nonecase&utm_term=g%2B%2B-7

错误六(example1错误):ompl/…/InformedRRTstar.h: 没有那个文件或目录

In file included from /home/ycx/catkin_ws/src/am_traj-master/example1/fsto/src/r3planner.cpp:1:0:
/home/ycx/catkin_ws/src/am_traj-master/example1/fsto/include/fsto/r3planner.h:11:57: fatal error: ompl/geometric/planners/rrt/InformedRRTstar.h: 没有那个文件或目录
compilation terminated.
am_traj-master/example1/fsto/CMakeFiles/example1_node.dir/build.make:101: recipe for target 'am_traj-master/example1/fsto/CMakeFiles/example1_node.dir/src/r3planner.cpp.o' failed
make[2]: *** [am_traj-master/example1/fsto/CMakeFiles/example1_node.dir/src/r3planner.cpp.o] Error 1

还是explme1问题

sudo apt-get install libompl-dev ompl-demos
sudo apt-get install  geometric*//无效
sudo apt-get install  ros-kinetic-ompl

其实可以先把explme1删了
sudo apt-get remove libompl-dev ompl-demos
sudo apt-get install  geometric*//无效
sudo apt-get remove  ros-kinetic-ompl

错误七(example1错误):libompl.so错误

make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libompl.so', needed by '/home/ycx/catkin_ws/devel/lib/example1/example1_node'。 停止。
sudo find / -name libompl.so
//  /usr/lib/x86_64-linux-gnu/libompl.so
//   /usr/local/lib/libompl.so

sudo ln -s /usr/local/lib/libompl.so /usr/lib/x86_64-linux-gnu/libompl.so
//      ln: 无法创建符号链接'/usr/lib/x86_64-linux-gnu/libompl.so': 文件已存在

sudo rm /usr/lib/x86_64-linux-gnu/libompl.so
sudo ln -s /usr/local/lib/libompl.so /usr/lib/x86_64-linux-gnu/libompl.so

参考https://blog.csdn.net/wonengguwozai/article/details/52723813

编译成功,跑程序失败(python 失败)

第一步可以,第二步错误,最后师兄说问题不大, rviz window第一步就出来,第二步好像就加个框

python src/am_traj/example1/key2joy.py
// python: can't open file 'src/am_traj/example1/key2joy.py': [Errno 2] No such file or directory

所以这个错误,我还没解决,先把已经做的放上来
换路径试试
~/catkin_ws/src/am_traj-master/example1$
python key2joy.py

Traceback (most recent call last):
  File "key2joy.py", line 124, in <module>
    main()
  File "key2joy.py", line 17, in main
    img = pygame.image.load("~/catkin_ws/src/am_traj-master/example1/keymap/keyboard3.jpg")
pygame.error: Couldn't open ~/catkin_ws/src/am_traj-master/example1/keymap/keyboard3.jpg

打不开,
sudo chmod +777 keyboard3.jpg
不行,改key2joy.py里的路劲为绝对路径,还是不行~/catkin_ws/src/am_traj-master/example1/keymap/keyboard3.jpg

上sudo,新错误
sudo python key2joy.py

Traceback (most recent call last):
  File "key2joy.py", line 5, in <module>
    import rospy
ImportError: No module named rospy

先看看ros有没有问题,参考https://blog.csdn.net/qq_17130909/article/details/81197222
sudo apt-get install ros-kinetic-desktop-full
不行,在看看我以前的ros配置https://blog.csdn.net/qq_45539458/article/details/106456408
sudo rosdep init
rosdep update
有时可能会有网络问题

最后找到这片https://blog.csdn.net/shuipengpeng/article/details/89223248
genpy是第二个错误,然后我就卡在roslib上,依赖错误,发现其实已经装了roslib,最后觉得可能是python2.7问题,系统自带一个,ros带一个

sudo apt-get install python-rospy
sudo apt-get install python-genpy
sudo apt-get install  python-roslib
sudo apt-get remove python-roslib
sudo pip install python-roslib
python -m pip install roslib

最后,换个pip源

pip 用的时候发现版本太老,于是升级,参考https://blog.csdn.net/shuipengpeng/article/details/89223248

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

但升级也失败,速度太慢,换源,参考https://www.cnblogs.com/sunnydou/p/5801760.html

vim ~/.pip/pip.conf
改为

[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

图解Python数据结构与算法-实战篇

csdn链接

https://download.csdn.net/download/qq_45539458/12594817

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
回答: 出现这个错误是因为系统无法找到catkin_make命令。根据引用\[1\]中的解决方案,删除.bashrc文件中最后一行的source /opt/ros/melodic/setup.bash是不正确的解决方法,因为这是必须的。根据引用\[2\]中的提示,你可以尝试使用以下命令来解决问题:git clone https://github.com/ros/catkin.git cd catkin git branch kinetic-devel mkdir build cd build cmake ... make -j8 sudo make install cd ... python2 setup.py install。这些命令将克隆catkin仓库并切换到kinetic-devel分支,然后进行编译和安装。如果你之前创建了其他python版本的软链接,可以根据引用\[3\]中的提示删除旧的软链接并重新创建新的软链接。这样应该能够解决/usr/bin/bash: catkin_make:未找到命令的问题。 #### 引用[.reference_title] - *1* *3* [【关于运行roscore等命令报错:bash: /opt/ros/melodic/_setup_util.py: /usr/bin/python: 解释器错误: ...](https://blog.csdn.net/wxy98520/article/details/123953509)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [安装MAVROS过程 catkin:未找到命令 的问题](https://blog.csdn.net/chamu99/article/details/113242268)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Dawn Yue

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

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

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

打赏作者

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

抵扣说明:

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

余额充值