@[TOC]
ubuntu如何查看版本信息?
小菜鸟安装Ubuntu18.04系统探险指南(适合新手入门)
Q:我有一台崭新的电脑,安装好双系统之后,如何查看自己的版本呢?
A:打开终端输入 cat /proc/version
即可查看我们的版本号
user@user-B460MPOWER:~$ cat /proc/version
Linux version 5.3.0-28-generic (buildd@lcy01-amd64-009) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020
安装CMake
官网适合自己电脑的版本: https://cmake.org/download/
CMake官网教程连接:https://cmake.org/cmake/help/latest/guide/tutorial/index.html
CMake安装后续步骤:https://blog.51cto.com/speakingbaicai/1087432
执行./bootstrap
时候报错,
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
参考链接:http://bbs.keinsci.com/thread-11819-1-1.html ==提示说是g++版本低,没有解决这个问题==
user@user-B460MPOWER:~/thirdLibrary/cmake/cmake-3.20.2$ ./bootstrap
---------------------------------------------
CMake 3.20.2, Copyright 2000-2021 Kitware, Inc. and Contributors
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /home/user/thirdLibrary/cmake/cmake-3.20.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
更换安装方式,现在版本cmake version 3.10.2
sudo apt install cmake
user@user-B460MPOWER:~$ cmake -version
cmake version 3.10.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
安装CLion
官网下载:https://www.jetbrains.com/clion/
安装包进行解压,在bin
文件目录下打开终端,运行./clion.sh
脚本文件,然后把破解补丁放入打开的CLion界面。
破解补丁下载:链接: https://pan.baidu.com/s/1hlrLKZiLWNLhV7I8kXEaRw 提取码: 6vic
Clion调试代码简介 视频链接
链接:https://pan.baidu.com/s/1RI5BbHvP2EtWamd1J0SRUQ 密码:ovba
安装Eigen库
安装openCV
ubuntu16.04 安装opencv 步骤和错误解决:https://blog.csdn.net/weixin_41896508/article/details/80795239
$ cd ~/opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=Release –D CMAKE_INSTALL_PREFIX=/usr/local ..
$ make –j8
$ sudo make install
==opencv编译卡在 IPPICV: Download: ippicv_2019_lnx_intel64_general_20180723.tgz== opencv 解决ippicv下载问题,离线:ippicv_2019_lnx_intel64_general_20180723.tgz https://blog.csdn.net/weixin_45250844/article/details/102159059 最后成功界面:
安装Ceres
出现问题:
-- Detected Ceres version: 2.0.0 from /home/user/thirdLibrary/ceres/ceres-solver/include/ceres/version.h
-- Detected available Ceres threading models: [CXX_THREADS, OPENMP, NO_THREADS]
-- Building with C++14
-- Found Eigen version 3.3.4: /usr/include/eigen3
-- Enabling use of Eigen as a sparse linear algebra library.
-- A library with BLAS API found.
-- Found LAPACK library: /usr/lib/x86_64-linux-gnu/liblapack.so;/usr/lib/x86_64-linux-gnu/libblas.so
-- A library with BLAS API found.
-- Found AMD headers in: /usr/include/suitesparse
-- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so
-- Found CAMD headers in: /usr/include/suitesparse
-- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so
-- Found COLAMD headers in: /usr/include/suitesparse
-- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so
-- Found CCOLAMD headers in: /usr/include/suitesparse
-- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so
-- Found CHOLMOD headers in: /usr/include/suitesparse
-- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so
-- Found SUITESPARSEQR headers in: /usr/include/suitesparse
-- Found SUITESPARSEQR library: /usr/lib/x86_64-linux-gnu/libspqr.so
-- Found Intel Thread Building Blocks (TBB) library (2017.0 / 9107) include location: /usr/include. Assuming SuiteSparseQR was compiled with TBB.
-- Found SUITESPARSE_CONFIG headers in: /usr/include/suitesparse
-- Found SUITESPARSE_CONFIG library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.so
-- Found LIBRT library: /usr/lib/x86_64-linux-gnu/librt.so
-- Adding librt: /usr/lib/x86_64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
-- Did not find METIS library (optional SuiteSparse dependency)
-- Found SuiteSparse 5.1.2, building with SuiteSparse.
-- Found CXSparse version: 3.1.9, building with CXSparse.
-- Building without Apple's Accelerate sparse support.
-- Use of gflags disabled - no tests or tools will be built!
-- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
-- Failed to find installed glog CMake configuration, searching for glog build directories exported with CMake.
-- Failed to find an installed/exported CMake configuration for glog, will perform search for installed glog components.
-- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
CMake Error at CMakeLists.txt:432 (message):
Can't find Google Log (glog). Please set either: glog_DIR (newer CMake
built versions of glog) or GLOG_INCLUDE_DIR & GLOG_LIBRARY or enable
MINIGLOG option to use minimal glog implementation.
-- Configuring incomplete, errors occurred!
See also "/home/user/thirdLibrary/ceres/ceres-solver/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/thirdLibrary/ceres/ceres-solver/build/CMakeFiles/CMakeError.log".
我们先根据官网信息把依赖的东西安装好再编译:http://ceres-solver.org/installation.html
# CMake
sudo apt-get install cmake
# google-glog + gflags
sudo apt-get install libgoogle-glog-dev libgflags-dev
# BLAS & LAPACK
sudo apt-get install libatlas-base-dev
# Eigen3
sudo apt-get install libeigen3-dev
# SuiteSparse and CXSparse (optional)
sudo apt-get install libsuitesparse-dev
tar zxf ceres-solver-2.0.0.tar.gz
mkdir ceres-bin
cd ceres-bin
cmake ../ceres-solver-2.0.0
make -j3
make test
# Optionally install Ceres, it can also be exported using CMake which
# allows Ceres to be used without requiring installation, see the documentation
# for the EXPORT_BUILD_DIR option for more information.
make install
在运行例子时出现
user@user-B460MPOWER:~/thirdLibrary/ceres/ceres-solver/ceres-bin/bin$ ./simple_bundle_adjuster ../ceres-solver/data/problem-16-22106-pre.txt
ERROR: unable to open file ../ceres-solver/data/problem-16-22106-pre.txt
段错误 (核心已转储)
我们安装的文件位置不同,所以要写在不同的路径上面
./simple_bundle_adjuster /home/user/thirdLibrary/ceres/ceres-solver/data/problem-16-22106-pre.txt
安装ROS
先设置软件仓库:https://help.ubuntu.com/community/Repositories/Ubuntu 再在官网上下载ROShttp://wiki.ros.org/melodic/Installation/Ubuntu,要和自己的系统版本相对应 Ubuntu18.04下安装ROS:https://blog.csdn.net/haiyinshushe/article/details/84256137 软件仓库的问题不是很明白为什么?https://help.ubuntu.com/community/Repositories/Ubuntu
还有一篇参考文献:https://m.linuxidc.com/Linux/2010-04/25744.htm
user@user-B460MPOWER:~$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
[sudo] user 的密码:
user@user-B460MPOWER:~$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
Executing: /tmp/apt-key-gpghome.E1P9vgw442/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
gpg: 密钥 F42ED6FBAB17C654:公钥“Open Robotics <info@osrfoundation.org>”已导入
gpg: 合计被处理的数量:1
gpg: 已导入:1
user@user-B460MPOWER:~$ sudo apt install ros-melodic-desktop-full
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 无法定位软件包 ros-melodic-desktop-full
user@user-B460MPOWER:~$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
user@user-B460MPOWER:~$ sudo apt-get update
获取:1 http://mirrors.ustc.edu.cn/ros/ubuntu bionic InRelease [4,680 B]
获取:2 http://mirrors.ustc.edu.cn/ros/ubuntu bionic/main amd64 Packages [756 kB]
错误:2 http://mirrors.ustc.edu.cn/ros/ubuntu bionic/main amd64 Packages
文件尺寸不符(755768 != 755589)。您使用的镜像正在同步中? [IP: 202.141.160.110 80]
Hashes of expected file:
- Filesize:755589 [weak]
- SHA256:8b22dcaa6bf1406f852f10c1ccf8e8856857698a34ff18c41e44df54049e895e
- SHA1:99d9bdde30d23acfe55a7b651ad058d332e5c1fc [weak]
- MD5Sum:22d120a1341089964c3115dc13d9954d [weak]
Release file created at: Tue, 27 Apr 2021 12:52:49 +0000
获取:3 http://mirrors.ustc.edu.cn/ros/ubuntu bionic/main i386 Packages [26.3 kB]
获取:26 http://cn.archive.ubuntu.com/ubuntu bionic-backports/main Sources [5,440 B]
已下载 13.0 MB,耗时 1分 22秒 (158 kB/s)
正在读取软件包列表... 完成
E: 无法下载 http://mirrors.ustc.edu.cn/ros/ubuntu/dists/bionic/main/binary-amd64/Packages.gz 文件尺寸不符(755768 != 755589)。您使用的镜像正在同步中? [IP: 202.141.160.110 80]
Hashes of expected file:
- Filesize:755589 [weak]
- SHA256:8b22dcaa6bf1406f852f10c1ccf8e8856857698a34ff18c41e44df54049e895e
- SHA1:99d9bdde30d23acfe55a7b651ad058d332e5c1fc [weak]
- MD5Sum:22d120a1341089964c3115dc13d9954d [weak]
Release file created at: Tue, 27 Apr 2021 12:52:49 +0000
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
user@user-B460MPOWER:~$ sudo apt install ros-melodic-desktop-full
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 无法定位软件包 ros-melodic-desktop-full
user@user-B460MPOWER:~$
==出现 E: 无法定位软件包 ros-melodic-desktop-full==
user@user-B460MPOWER:~$ sudo apt install ros-melodic-desktop-full
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 无法定位软件包 ros-melodic-desktop-full
更改镜像源还是无法定位。 ubuntu 下安装ROS失败的解决方法总结 参照下面的链接可以进行下一步 了 Ubuntu18.04.1安装ROS('E:无法定位软件包') 只要更新那一步骤出错,我们就无法在下一步安装时定位到软件包。
E: 无法下载 http://mirrors.ustc.edu.cn/ros/ubuntu/dists/bionic/main/binary-amd64/Packages.gz 文件尺寸不符(755768 != 755589)。您使用的镜像正在同步中? [IP: 202.141.160.110 80]
Hashes of expected file:
- Filesize:755589 [weak]
- SHA256:8b22dcaa6bf1406f852f10c1ccf8e8856857698a34ff18c41e44df54049e895e
- SHA1:99d9bdde30d23acfe55a7b651ad058d332e5c1fc [weak]
- MD5Sum:22d120a1341089964c3115dc13d9954d [weak]
Release file created at: Tue, 27 Apr 2021 12:52:49 +0000
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
user@user-B460MPOWER:~$ sudo apt-get install ros-melodic-desktop-full
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 无法定位软件包 ros-melodic-desktop-full
user@user-B460MPOWER:~$
W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
使用官网太慢 ubuntu18.04下为ros-melodic添加清华源加快下载速度
两者速度对比一下
sudo apt install python-rosdep2 -y
Q:为什么我的代码比别人多了个-y? A:因为这些代码基本上复制执行就是要安装的,省去你一会还要输入y+回车的时间
user@user-B460MPOWER:~$ export | grep ROS
declare -x ROS_DISTRO="melodic"
declare -x ROS_ETC_DIR="/opt/ros/melodic/etc/ros"
declare -x ROS_MASTER_URI="http://localhost:11311"
declare -x ROS_PACKAGE_PATH="/opt/ros/melodic/share"
declare -x ROS_PYTHON_VERSION="2"
declare -x ROS_ROOT="/opt/ros/melodic/share/ros"
declare -x ROS_VERSION="1"
ORB-SLAM
==fatal: 过早的文件结束符(EOF)==
user@user-B460MPOWER:~/github$ git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git ORB_SLAM3
正克隆到 'ORB_SLAM3'...
remote: Enumerating objects: 800, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (72/72), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: 过早的文件结束符(EOF)
fatal: index-pack 失败
安装VINS
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git
sudo apt-get install ros-melodic-cv-bridge ros-melodic-tf ros-melodic-message-filters ros-melodic-image-transport
==根据readme.md
进行编译,记得18。04 对应melodic,16.04对应kinetic
最开始写错版本的时候会在home隐藏文件里面添加kinetic,所以我们在home文件下Ctril+H
显示隐藏文件,打开.bashrc
把最后几行和kinetic相关的东西删掉就好。==
user@user-B460MPOWER:~/github/catkin_ws$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
user@user-B460MPOWER:~/github/catkin_ws$ source ~/.bashrc
bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录
bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录
bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录
user@user-B460MPOWER:~/github/catkin_ws$ catkin_init_workspace
Creating symlink "/home/user/github/catkin_ws/CMakeLists.txt" pointing to "/opt/ros/melodic/share/catkin/cmake/toplevel.cmake"
user@user-B460MPOWER:~/github/catkin_ws$ cd src
user@user-B460MPOWER:~/github/catkin_ws/src$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
user@user-B460MPOWER:~/github/catkin_ws/src$ source ~/.bashrc
bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录
bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录
bash: /opt/ros/kinetic/setup.bash: 没有那个文件或目录
user@user-B460MPOWER:~/github/catkin_ws/src$ catkin_init_workspace
Creating symlink "/home/user/github/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/melodic/share/catkin/cmake/toplevel.cmake"
user@user-B460MPOWER:~/github/catkin_ws/src$ cd ..
user@user-B460MPOWER:~/github/catkin_ws$ catkin_make
Base path: /home/user/github/catkin_ws
Source space: /home/user/github/catkin_ws/src
Build space: /home/user/github/catkin_ws/build
Devel space: /home/user/github/catkin_ws/devel
Install space: /home/user/github/catkin_ws/install
roslaunch ar_demo 3dm_bag.launch
roslaunch ar_demo ar_rviz.launch
rosbag play /home/user/github/dataset/ar_box.bag
RLException: [3dm_bag.launch] is neither a launch file in package [ar_demo] nor is [ar_demo] a launch file name
The traceback for the exception was written to the log file
这是因为没有source devel/setup.bash
的缘故,记得roslaunch文件要分三个终端运行,每次运行前都要有source devel/setup.bash