注意,此文档中:
部分内容可能已经过时
部分链接可能已经失效
有些步骤对普通开发者没有必要
强烈建议:
尝试更新版本的ubuntu,至少是20.04
弄清楚每一步是在干嘛
使用ubuntu而不是windows进行开发
使用命令行而不是GUI(至少一开始)
以及:
There are several ways to do this. We’ll list them from easy to hard.
Get a new clean hard disk.
Find a disk with enough space and GPT partition table. You can find the partition table type in ‘’diskmgmt.msc’‘, by right clicking a disk and select’‘Property’‘. Then use’‘Shrink Volume’’ to create free space. Read https://www.tecmint.com/install-ubuntu-alongside-with-windows/ for this approach.
Find a disk with enough space and MBR partition table. Then use the Windows MBR2GPT tool to convert it to GPT. This is not recommended.
Use Ubuntu USB image to start the installation wizard. Possible issues and solutions:
Select language and keyboard layout.
Select ‘’Normal Installation’‘. Don’t check’‘Download updates’‘. Don’t check’‘Install third-party software’’.
Select ‘’Something else’’.
If you’re using a new disk, select the disk and click ‘’New Partition Table’‘. All space on this disk will become’‘free space’‘. If you’re using a shrinked volume, find the’‘free space’’ you just created. Possible issues and solutions:
Select the ‘’free space’‘, create following partitions by clicking’‘+’’.
= 500MB, EFI
= 20GB, ext4, /boot
= 30GB, ext4, /
Double check your changes to the disk. This may erase all your data.
Select timezone, set user name, computer name, password, and start installation.
Wait until Ubuntu prompts to restart. If dual boot is not working, you may need to change your BIOS settings. Read https://www.tecmint.com/install-ubuntu-alongside-with-windows/.
Open ‘’Software & Updates’’.
Goto ‘’Ubuntu Software’‘, select’‘Other’’ for ‘’Download from’’, choose mirrors.tuna.tsinghua.edu.cn.
‘’sudo apt update && sudo apt upgrade’’.
If you are using an NVidia graphics card, goto ‘’Additional Drivers’‘, select’‘Using NVIDIA driver metapackage from nvidia-driver-470’’ or the latest nvidia driver, click ‘’Apply Changes’’, enter your password when prompted, wait until the installation finishes and you are prompted to restart the machine.
Restart. You can connect to multiple monitors and/or use DP cable now.
下载cuda(你需要根据版本修改对应链接) http://developer.download.nvidia.com/compute/cuda/10.1/Prod/localinstallers/cuda10.1.243418.87.00linux.run.
安装
sudo apt install gcc
chmod +x cuda_10.1.243_418.87.00_linux.run && sudo ./cuda_10.1.243_418.87.00_linux.run
(注意不要选择安装驱动!!!)In the shell ui, ‘’Continue’’ -> accept -> Deselect Driver -> ‘’Install’’
Add following lines to ~/.bashrc:
export PATH=/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_PATH=/usr/local/cuda-10.1
Download https://developer.nvidia.com/designworks/videocodecsdk/downloads/v9.1 and extract <VideoCodecSDK_9.1>/include/* to /usr/local/cuda-10.1/include/.
Restart shell and ‘’sudo ldconfig’’.
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-py39_4.10.3-Linux-x86_64.sh
以及各种乱七八糟的依赖
sudo apt install gcc-8 g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 200 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo update-alternatives --config gcc
sudo apt install clang git tar unzip ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev libpng-dev libturbojpeg0-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev libegl1-mesa-dev libgl1-mesa-dev libglu1-mesa-dev libgles2-mesa-dev libglfw3-dev libtbb-dev libgoogle-glog-dev libatlas-base-dev libsuitesparse-dev libgmp-dev libmpfr-dev libzmqpp-dev libassimp-dev libfmt-dev libomp-dev xorg-dev autoconf libtool libxcb-xinput0
sudo apt install libxcb-image0-dev libxcb-icccm4-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-keysyms1-dev libxcb-xinerama0-dev libxcb-xinput-dev libxcb-util-dev libxcb-xkb-dev
sudo apt install cmake
或者用python3的pip安装(没想到吧,pip上也有cmake,而且版本更新)
pip install cmake
conan 是一个 c++ 包管理工具,如果你不知道它是啥,你多半用不到
conda create -n conan python=3.7
conda activate conan
conda install conan -c conda-forge
Generate default profile:
conan profile new default --detect
… and if you are using gcc on Ubuntu
conan profile update settings.compiler.libcxx=libstdc++11 default
使用等略