1.卸载Ubuntu18.04
必须用f2进入bios将windows的启动顺序移动至第一顺位。否则删除ubuntu之后会无法开机
随后用磁盘管理卸载ubuntu分区,用diskgenius软件卸载efi分区。
2.安装Ubuntu20.04
用软碟通软件打开ubuntu iso镜像,写入硬盘映像到u盘。
重启,f12进入拯救者笔记本的启动页面。u盘一定要插紧
选择linpus lite(flash)->
ubuntu(safe graphics)
normal installation with third party
along windows,continue
3.配置Ubuntu20.04
由于安装的时候选择了with third party,所以wifi/显卡驱动都直接装好了。保险起见,记得禁用一下nouveau:https://blog.csdn.net/xue_csdn/article/details/102391145
永远不要用以下命令:
sudo apt upgrade
升级之后会导致n卡驱动,wifi驱动,亮度调节器全部宕机。
锁住内核,防止自动更新的方法:
https://blog.csdn.net/maohule/article/details/107370788
3.1 change software source:
go to software & updates
choose mirros.aliyun.com
3.2 pinyin install:
sudo apt install fcitx
im-config
(choose fcitx)
fcitx-config-gtk3
(choose google pinyin)
ctrl+” ” shift the input language
refering to
https://ywnz.com/linuxjc/2891.html#:~:text=%E5%9C%A8Ubuntu18.04%E7%B3%BB%E7%BB%9F%E4%B8%AD%E5%AE%89%E8%A3%85%E8%B0%B7%E6%AD%8C%E6%8B%BC%E9%9F%B3%E8%BE%93%E5%85%A5%E6%B3%95%EF%BC%88Google%20Pinyin%EF%BC%89%E9%9D%9E%E5%B8%B8%E7%AE%80%E5%8D%95%EF%BC%8C%E5%8F%AA%E9%9C%80%E8%A6%81%E4%B8%8B%E9%9D%A2%E8%BF%99%E4%B8%AA%E5%91%BD%E4%BB%A4%EF%BC%9A%20sudo,apt%20install%20fcitx-googlepinyin
google pinyin太丑了用不习惯。索性放弃
参考https://blog.csdn.net/wu10188/article/details/86540464尝试ibus
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4
im-config -s ibus
sudo ibus-setup
win+“ ” to shift the language
重启即可
3.3 ros安装
参照https://blog.csdn.net/qq_44339029/article/details/120579608
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 apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
sudo apt install ros-noetic-desktop-full
rosdep超时问题一招解决:https://zhuanlan.zhihu.com/p/397624291
sudo apt-get install python3-pip
sudo pip3 install rosdepc
sudo rosdepc init
rosdepc update
sudo apt install ros-noetic-desktop-full
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
roscore
关于ROS2的安装,参照https://blog.csdn.net/hunterhe/article/details/112647916,基本上可以一步到位
3.4 cuda安装
lsmod | grep nouveau
nvidia-smi
nvidia自带版本为510,gcc为9.7.0。对应cuda版本应该为11.6,cudnn版本为
sudo apt-get install gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 50
~/Downloads/installpkg$ sudo bash cuda_10.0.130_410.48_linux.run
/usr/local/cuda-10.0/bin$ sudo ./uninstall_cuda_10.0.pl
cuda官网:https://developer.nvidia.com/cuda-toolkit
cudnn:https://developer.nvidia.com/cudnn
wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_510.39.01_linux.runsudo sh cuda_11.6.0_510.39.01_linux.run
由于暂时登不上nvidia官网,并且我发现darknet ros不需要cuda就可以跑。因此我暂时不安装cuda了
查看nvidia驱动版本:
dpkg -l | grep nvidia
查看内核:
dpkg –get-selections | grep linux
sudo apt list –upgradable
run文件安装报错:Existing package manager installation of the driver found.
于是尝试apt安装:
sudo apt install nvidia-cuda-toolkit
[sudo] password for car:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ca-certificates-java fonts-dejavu-extra java-common libaccinj64-10.1
libatk-wrapper-java libatk-wrapper-java-jni libcublas10 libcublaslt10
libcudart10.1 libcufft10 libcufftw10 libcuinj64-10.1 libcupti-dev
libcupti-doc libcupti10.1 libcurand10 libcusolver10 libcusolvermg10
libcusparse10 libjs-underscore libncurses5 libnppc10 libnppial10 libnppicc10
libnppicom10 libnppidei10 libnppif10 libnppig10 libnppim10 libnppist10
libnppisu10 libnppitc10 libnpps10 libnvblas10 libnvgraph10 libnvidia-ml-dev
libnvjpeg10 libnvrtc10.1 libnvtoolsext1 libnvvm3 libthrust-dev libtinfo5
libvdpau-dev node-html5shiv nsight-compute nsight-systems nvidia-cuda-dev
nvidia-cuda-doc nvidia-cuda-gdb nvidia-opencl-dev nvidia-profiler
nvidia-visual-profiler ocl-icd-opencl-dev opencl-c-headers openjdk-8-jre
openjdk-8-jre-headless
Suggested packages:
default-jre libvdpau-doc nodejs nvidia-driver | nvidia-tesla-440-driver
| nvidia-tesla-418-driver libpoclu-dev icedtea-8-plugin fonts-ipafont-gothic
fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei
Recommended packages:
libnvcuvid1
The following NEW packages will be installed:
ca-certificates-java fonts-dejavu-extra java-common libaccinj64-10.1
libatk-wrapper-java libatk-wrapper-java-jni libcublas10 libcublaslt10
libcudart10.1 libcufft10 libcufftw10 libcuinj64-10.1 libcupti-dev
libcupti-doc libcupti10.1 libcurand10 libcusolver10 libcusolvermg10
libcusparse10 libjs-underscore libncurses5 libnppc10 libnppial10 libnppicc10
libnppicom10 libnppidei10 libnppif10 libnppig10 libnppim10 libnppist10
libnppisu10 libnppitc10 libnpps10 libnvblas10 libnvgraph10 libnvidia-ml-dev
libnvjpeg10 libnvrtc10.1 libnvtoolsext1 libnvvm3 libthrust-dev libtinfo5
libvdpau-dev node-html5shiv nsight-compute nsight-systems nvidia-cuda-dev
nvidia-cuda-doc nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-opencl-dev
nvidia-profiler nvidia-visual-profiler ocl-icd-opencl-dev opencl-c-headers
openjdk-8-jre openjdk-8-jre-headless
0 upgraded, 57 newly installed, 0 to remove and 127 not upgraded.
Need to get 1,398 MB of archives.
成功安装
3.5 opencv
查看opencv版本:
pkg-config --modversion opencv
发现ros下自带opencv4.2了。为了保证opencv的稳定性,不打算装cuda版的opencv了
cmake -DWITH_GTK_2_X=ON -DWITH_CUDA=ON -DOPENCV_EXTRA_MODULES_PATH=/home/car/Downloads/installpkg/opencv-cuda/opencv_contrib-3.3.0/modules ..
报错:
error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
解决办法:https://blog.csdn.net/guo_lei_lamant/article/details/81568346
在/home/car/Downloads/installpkg/opencv-3.3.0/modules/videoio/src/cap_ffmpeg_impl.hpp添加:
#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020
报错:error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
在/home/car/Downloads/installpkg/opencv-3.3.0/modules/python/src2/cv2.cpp
环境配置:https://blog.csdn.net/public669/article/details/99044895
对于vins等程序,必须在cmakelists指定版本为3
-std=c++11改为14(解决了pcl问题)
pcl/sophus都会有问题
并且要加上新的h文件
参照https://blog.csdn.net/weixin_43421058/article/details/119139425
https://zhuanlan.zhihu.com/p/418227536
以及
find_package(OpenCV 3 REQUIRED)
汇总在这里https://wenda.ncnynl.com/article/5
编译可以通过,运行会死
1.试试opencv3:set(OpenCV_DIR /home/nvidia/opencv-3.0.0/build)
2.cv::FONT_HERSHEY_SIMPLEX
3.-std=c++11改为14
4.#include<opencv2/imgproc/types_c.h>
libopencv_imgcodecs.so.3.3, needed by /home/car/Downloads/installpkg/opencv-3.3.0/build/lib/libopencv_sfm.so.3.3.0, may conflict with libopencv_imgcodecs.so.4.2
依然运行报错
将源代码下的所有CMakeList.txt中的find_package(OpenCV REQUIRED),改成find_package(OpenCV 4 REQUIRED),可以成功!
主要参照的博客有:
关于opencv的纠正:https://wenda.ncnynl.com/article/5
https://blog.csdn.net/qq_41246375/article/details/109390019
https://blog.csdn.net/weixin_43421058/article/details/119139425
vinsfusion:https://blog.csdn.net/xiaojinger_123/article/details/121517771
3.6 SLAM依赖库
src文件夹下除去gtsam都安装成功了
sudo apt-get install intel-mkl
依然失败
eigen:
sudo cp -r /usr/include/eigen3/Eigen /usr/include
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
ceres的依赖如下:
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3.1.2 libgflags-dev libgoogle-glog-dev libgtest-dev
sophus:
注意org版本对应的才是vinsfusion需要的sophus
vscode安装:https://developer.aliyun.com/article/759454
文章出处登录后可见!