unbuntu APT-GET工作原理:https://www.cnblogs.com/cyl2008/p/6417443.html
1,“sudo apt -get install” 下载安装软件包大体分为四个步骤:
(1)
sudo apt-get install openssh-client = 1:6.6p1-2ubuntu1
sudo apt-cache madison openssh-client
参考:https://zh.wikipedia.org/wiki/APT
2,(1)软件源就是一个应用程序安装库,很多应用软件都在这个库里面,它可以是网络服务器,光盘,甚至是硬盘上的一个目录。作为debian系的ubuntu,继承了debian的deb和apt系统,只要设定好了软件源,就能方便的安装软件了。 常见的软件源类型有GME,APT,YAST,ISO,YUM,UAP源。
(2)更换软件源 参考:https://www.cnblogs.com/dadonggg/p/11129973.html
cp /etc/apt/sources.list /etc/apt/sources.list.back
vi /etc/apt/sources.list
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
中科大源
##中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
163源
##163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
清华源
##清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
apt-get update
apt-get upgrade
3,(1)参考:https://www.1024sou.com/article/314753.html
直接在ubuntu 软件商店安装,直接搜索软件名,然后点击安装输入密码就可以了。
apt命令安装,不止ubuntu,其实Debian系统的系统(Debian,Deppin,Raspbian)都可以使用apt安装软件。
使用snap命令安装;
使用dpkg命令安装deb包,前三种只能安装已经添加到软件源里的软件。但第三方软件并没有在软件原里面,而是在官网提供的deb后缀的软件包下载这种软件用dpkg命令安装
使用源码编译安装,在软件源中没有需要安装的软件时,使用源码安装:步骤
1,配置
有些软件源码根目录下会有一个用于配置的脚本文件(configure),执行./configure命令脚本会根据当前的系统环境配置一些东西。一般这个脚本也可以传一些参数来定制要编译的内容,在INSTALL文件或README文件里面会讲都有哪些参数。
2,编译
大部分开源软件都是使用make命令来编译软件,直接在源码目录下运行make就行。 对于有多种不同make参数的项目,说明文件里面也会讲到。
3,安装
除了一些只编译成一个二进制文件可以到处用的软件外,大部分软件编译以后都是要安装的。一般的安装命令是sudo make install。不过也不排除有其他安装方法,可以看源码说明文件
(2)Fedora,centos 的软件包管理工具:rpm,yum
Debian.ubuntu 的软件包管理工具:dpkg , apt-get
4,(1)环境变量PATH :用来指定可执行文件的搜索路径。
比如,当我们希望直接在cmd中运行一个程序时,我们在命令行中输入该程序对应的可执行文件时(一般是后缀名为.exe的文件)。系统首先会在cmd所在的目录下搜索此路径,如果没有搜索到,系统会到Path环境变量所指定的路径中去找。如果找到,就正常执行,还没找到,就报错。 参考:https://www.cnblogs.com/wilson403/p/10878810.html
(2)LD_LIBRARY_PATH环境变量用于在程序加载运行期间查找动态链接库时指定除了系统默认路径之外的其他路径,注意,LD_LIBRARY_PATH中指定的路径会在系统默认路径之前进行查找。设置方法如下(其中,LIBDIR1和LIBDIR2为两个库目录):
export LD_LIBRARY_PATH=LIBDIR1:LIBDIR2:$LD_LIBRARY_PATH
(4)ldconfig是一个动态链接库管理命令,为了让动态链接库为系统所共享,还需运行动态链接库的管理命令–ldconfig。 ldconfig 命令的用途,主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,搜索出可共享的动态 链接库(格式如前介绍,lib*.so*),进而创建出动态装入程序(ld.so)所需的连接和缓存文件.缓存文件默认为 /etc/ld.so.cache,此文件保存已排好序的动态链接库名字列表.
参考:https://www.cnblogs.com/274914765qq/p/4567283.html
5,(1):Linux的访问文件权限分为读,写,执行三种
(2):chmod xxx 修改文件权限
4代表读权限,2代表写权限,1代表执行权限
7=4+2+1,表示拥有可读可写可执行权限
5=4+1,表示拥有可读可执行权限,但是没有写权限
4 代表拥有可读权限
0 代表没有任何权限
6,(1)在linux中的每个用户必须属于一个组,不能独立于组外。在linux中每个文件有所有者、所在组、其它组的概念。
Linux系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统。
用户的账号一方面可以帮助系统管理员对使用系统的用户进行跟踪,并控制他们对系统资源的访问;另一方面也可以帮助用户组织文件,并为用户提供安全性保护
7,gcc, g++ ,cmake
c++ 11,17,18都支持
1,(1)增强现实:利用平板可以观察选中的家具在自己房间摆放和搭配的效果
(2)SLAM在自动驾驶领域的应用,如无人驾驶利用激光雷达传感器来获取地图数据,构建地图,规避路程中遇到的障碍实现路径规划
(3)SLAM在机器人领域的应用,如扫地机器人等。
2,for being precisely localized in an environment,
a correct map is necessary, but in order to construct a good map it is necessary to be prop-
erly localized when elements are added to the map.
3,4,请阅读文献
5,(1)LSD-SLAM:基于直接跟踪的V-SLAM
(2)PTAM :实时SFM系统,也是首个基于关键帧BA的单目V-SLAM系统。
(3)MonoSLAM:基于单目的纯视觉SLAM系统
# 指明对cmake的最低版本要求
cmake_minimum_required(VERSION 3.4)
# 定义工程的名字
PROJECT(HELLO)
# 设置用Release模式编译这个工程
SET(CMAKE_BUILD_TYPE "Release")
# 添加头文件
INCLUDE_DIRECTORIES(./include)
# 构建动态链接库
ADD_LIBRARY(hello SHARED ./src/hello.cpp)
# INSTALL指令 安装动态链接库和头文件
INSTALL(TARGETS hello
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(FILES ./include/hello.h DESTINATION include)
# 让工程找到 FindHELLO.cmake模块
SET(CMAKE_MODULE_PATH ~/Document/backup/cmake/t5/cmake)
MESSAGE(${CMAKE_MODULE_PATH})
# 使用find_package查找定义的动态链接库
FIND_PACKAGE(Hello REQUIRED)
IF(HELLO_FOUND)
MESSAGE(${CMAKE_MODULE_PATH})
ADD_EXECUTABLE(sayHello useHello.cpp)
# 为Target添加共享库
TARGET_LINK_LIBRARIES(sayHello hello)
ENDIF(HELLO_FOUND)
sudo apt-get install libgflags-dev
sudo apt-get install libgoogle-glog-dev
sudo apt-get install libgtest-dev
git clone https://ghproxy.com/https://github.com/gflags/gflags.git gflags_stable
cd gflags_stable
mkdir build
cd build
cmake .. -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC ..
make
sudo make install
git clone https://ghproxy.com/https://github.com/google/glog
sudo apt-get install autoconf automake libtool
cd glog
mkdir build
cd build
cmake ..
make
sudo make install
git clone https://ghproxy.com/https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install
(2)(3) (4)
#include "hello.h"
#include
#include "glog/logging.h"
void sayHello()
{
LOG(INFO)<<"Hello SLAM";
}
void GlogInit(char* name){
//初始化GLOG
google::InitGoogleLogging(name);
google::SetLogDestination(google::GLOG_INFO, "log");
google::SetStderrLogging(google::GLOG_INFO);
}
void GlogUnInit()
{
google::ShutdownGoogleLogging();
}
#include "hello.h"
#include
#include
#include
#include
#include
using namespace std;
DEFINE_int64(print_times,1,"print times");
void GlogInit(char* name);
void GlogUnInit();
int main( int argc, char** argv ) {
//GFLAGS
gflags::ParseCommandLineFlags(&argc, &argv, true);
//GTEST
EXPECT_GE(FLAGS_print_times, 0);
GlogInit(argv[0]);
for(int i=0; i<FLAGS_print_times; i++)
sayHello();
GlogUnInit();
return 0;
}
cmake_minimum_required(VERSION 3.4)
PROJECT(HELLO)
SET(CMAKE_BUILD_TYPE "Release")
INCLUDE_DIRECTORIES(./include)
ADD_LIBRARY(hello SHARED ./src/hello.cpp)
INSTALL(TARGETS hello
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(FILES ./include/hello.h DESTINATION include)
SET(CMAKE_MODULE_PATH ~/Document/backup/cmake/t5/cmake)
MESSAGE(${CMAKE_MODULE_PATH})
FIND_PACKAGE(Hello REQUIRED)
FIND_PACKAGE(glog REQUIRED)
INCLUDE_DIRECTORIES(${glog_INCLUDE_DIR})
FIND_PACKAGE(gflags REQUIRED)
INCLUDE_DIRECTORIES(${gflags_INCLUDE_DIR})
IF(HELLO_FOUND)
MESSAGE(${CMAKE_MODULE_PATH})
ADD_EXECUTABLE(sayHello useHello.cpp)
TARGET_LINK_LIBRARIES(sayHello hello glog gflags gtest)
ENDIF(HELLO_FOUND)
(a),将编译出8个可执行二进制文件(8个进程)分别是:rgbd_tum stereo_kitti stereo_euroc mono_tum mono_kitti mono_euroc 19个库文件:System Tracking LocalMapping ORBextractor LoopClosing ORBmatcher FrameDrawer MapPoint KeyFrame Map MapDrawer Optimizer PnPsolver Frame KeyFrameDatabase SIm3Solver Initializer Viewer这几个库文件
(b), include下有20个头文件,src下有19个cc文件 , Example下有三个目录:RGB-D ROS Stereo
(3),可执行文件链接了5个库分别是:OpenCV,EIGEN3 ,Pangolin, libDBow2, libg2o
(1) 在github主页上下载库并安装第三方库,安装依赖项:
#下载Eigen库,并安装
cd eigen-3.3.9
mkdir build && cd build
cmake ..
sudo make install
#下载安装Pangolin
cd Pangolin-0.5
sudo apt-get install libglew-dev
sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev
sudo apt-get install libpython2.7-dev
cmake
mkdir build && cd build
cmake ..
make -j4
sudo make install
如果 make报错类似:‘AV_PIX_FMT_XVMC_MPEG2_MC’ was not declared in this scope
参考:[https://blog.csdn.net/Robert_Q/article/details/121690089?utm_source=app&app_version=5.0.0](%EF%BC%9Ahttps://blog.csdn.net/Robert_Q/article/details/121690089?utm_source=app&app_version=5.0.0)
#安装Sophus库
cd Sophus
mkdir build && cd build
cmake ..
make -j4
sudo make install
+ + 如报错类似:error: implicitly-declared ‘Eigen::Map<Sophus::SO2<double> >::Map(const Eigen::Map<Sophus::SO2<double> >&)’ is deprecated [-Werror=deprecated-copy]
+ 打开CMakelists,找**CMAKE_CXX_FLAGS**在**end if**下面添加以下代码覆盖原来的flags:
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated-declarations -Wno-deprecated-declarations")
参考:https://blog.csdn.net/weixin_41698305/article/details/116547361
#安装Ceres-solver
sudo apt-get install libgoogle-glog-dev libgflags-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libsuitesparse-dev
cd ceres-solver
mkdir build && cd build
cmake ..
make -j4
make test
sudo make install
#安装g2o
sudo apt-get install libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5
cd g2o
mkdir build && cd build
cmake ..
make
sudo make install
#DBoW3安装
d DBow3-master
mkdir build && cd build
cmake ..
make -j4
sudo make install
#OpenCV安装
(1)安装依赖项:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libatlas-base-dev gfortran libgtk2.0-dev libjpeg-dev libpng-dev
sudo apt-get install mlocate
(2)开始安装:
进入下载的安装压缩包,解压到某文件夹,然后进去该文件夹建立build文件夹 编译文件夹
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make -j4
sudo make install
(3)配置环境变量
sudo vim /etc/ld.so.conf.d/opencv.conf
在打开的空白文件中添加 /usr/local/lib
执行sudo ldconfig,使配置的环境变量生效
(4)配置.bashrc,末尾添加下面两行
//打开.bashrc
sudo gedit ~/.bashrc
//添加以下两行内容到.bashrc
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
(5)source 与 update
source ~/.bashrc
sudo updatedb