ubuntu新系统环境配置集锦

文章目录

  • 1. 安装ros
  • 2. 查看cmake、gcc版本
  • 3. 安装qt
  • 4. 安装cloudcomapre
  • 5. 安装ceres
  • 6. 安装gtsam
  • 7. 安装g2o
  • 8. 安装opencv
  • 9. 使用git命令

1. 安装ros

参照 ROS官网

PS:需要在/etc/hosts中添加github相关ip (github图片显示问题)
kinetic默认安装pcl1.7,eigen3.3.4
melodic默认安装pcl1.8,eigen3.3.4,opencv3.2.0

2. 查看cmake、gcc版本

cmake --version
gcc -v
qmake -v 

3. 安装qt

  1. 在官网选择版本
sudo chmod a+x qt*.run
./qt*.run  # 默认安装在/home
  1. 使用qtchooser配置
sudo apt install qtchooser
qtchooser -l  #查看
qtchooser -install qt5.12 /home/cyz/softwares/qt5.12.8/5.12.8/gcc_64/bin/qmake  # 设置路径
export QT_SELECT=qt5.12
# 查看qt版本
qmake -v 
# 如果显示 qmake: could not find a Qt installation of ''
which qmake  # 查看qmake
sudo rm /usr/bin/qmake  # 删除原有链接
sudo ln -s /home/cyz/softwares/qt5.12.8/5.12.8/gcc_64/bin/qmake /usr/bin/qmake  # 重新建立连接

关于 libQt5xxx:对‘Qxxxx::xxxx()@Qt5’未定义的引用错误 的解决方法
使用libqt5*报错解决方案-github

4. 安装cloudcomapre

  1. snap
sudo snap install cloudcompare
cloudcompare.ccViewer
cloudcompare.CloudCompare
  1. 源码编译
sudo apt install libtbb-dev  # TBB
sudo apt install libpdal-dev  # PDAL
# opengl
sudo apt-get install freeglut3-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install libglut-dev

找不到qt请参考CloudCompare: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.12’ not found (required by CloudCompare)

Plugins

  • Animation : 依赖ffmpeg,需要在cmake中标记FFMPEG_INCLUDE_DIR与FFMPEG_LIBRARY_DIR以及WITH_FFMPEG_SUPPORT选项

NOTE
LIBRARY_PATH环境变量:指定程序静态链接库文件搜索路径(.a)
LD_LIBRARY_PATH环境变量:指定程序动态链接库文件搜索路径(.so)

5. 安装ceres

GitHub

# 安装glog、gflags等依赖
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3.1.2 libgflags-dev libgoogle-glog-dev libgtest-dev
# 安装
cd ceres*
mkdir build & cd build
cmake ..
make -j8
make DESTDIR=/specific/directory install

参考:

  • Ubuntu18.04安装Ceres1.14
  • ceres-installation

PS* 使用自定义路径的ceres(CMakeLists):

# 定义自己编译的Ceres的库目录
set(Ceres_LIBS_DIR /home/cyz/environments/ceres-solver-1.14.0/makeinstalled/usr/local/lib)
# 定义CeresConfig.cmake所在文件目录
set(Ceres_DIR ${Ceres_LIBS_DIR}/cmake/Ceres)
# 找Ceres库
find_package(Ceres REQUIRED)
message(STATUS "Found Ceres: ${CERES_FOUND}")
message(STATUS "    Ceres Include Dirs: ${CERES_INCLUDE_DIRS}")
message(STATUS "    Ceres Libs: ${CERES_LIBRARIES}")

6. 安装gtsam

GitHub

cd gtsam*
mkdir build & cd build
cmake ..  # check installed lib version
make -j8
make DESTDIR=/specific/directory install

# CMakeLists
find_package(GTSAM REQUIRED PATHS "/home/cyz/environments/gtsam-4.0.0-alpha2/makeinstalled/usr/local/lib/cmake/GTSAM" NO_DEFAULT_PATH)

# 未解决:找不到gtsam/gtsam.h等
include_directories("/home/cyz/environments/gtsam-4.0.0-alpha2/makeinstalled/include")

PS* cant find libmetis.so

7. 安装g2o

GitHub

# CMakeList中配置
include_directories( ${PROJECT_SOURCE_DIR}/Thirdparty/g2o)
target_link_libraries(lidarMapping_node ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBS}
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_csparse_extension.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_stuff.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_core.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_types_data.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_solver_pcg.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_solver_cholmod.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_solver_csparse.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_types_slam3d.so
        ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o_types_slam3d_addons.so
        libcxsparse.so)

8. 安装opencv

Github

# CMakeList中配置
find_package(OpenCV REQUIRED PATHS /home/cyz/environments/opencv-3.4.13/makeinstalled/share/OpenCV)

pkg-config --modversion opencv  # 查看默认版本

参考 博客1

知乎:CMakeList.txt在大型文件应用(SLAM常用库添加依赖项)

9. 使用git命令

git status  # 查看已改变的状态信息

git add <file>  # 添加某个文件到缓冲区

git add .  # 添加所有更改到缓冲区

git commit -m "say sth"  # 添加文字描述

git reset HEAD <file>  # 停止更新(追蹤)

git push  # 将更改上传到仓库

git pull origin <远程分支名>:<本地分支名>    # 将远程指定分支 拉取到 本地指定分支上, 参考[博客](https://blog.csdn.net/u010059669/article/details/82670484)

#使用token管理仓库
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git

使用代理时会出现unable to access ‘https://XXXXXX.git/’: Could not resolve proxy: http
关闭代理,重新启动终端

你可能感兴趣的:(ubuntu)