PA0
1. Linux 的相关初步设置
仅附上工程内容。系统:Ubuntu 22.04.04-desktop-amd64
更新APT源:
sudo bash -c 'echo "deb https://mirrors.bfsu.edu.cn/ubuntu/ jammy main restricted universe multiverse" > /etc/apt/sources.list'
sudo cat /etc/apt/sources.list
sudo apt-get update
安装常用工具:
# install basic tools
apt-get install build-essential # build-essential packages, include binary utilities, gcc, make, and so on
apt-get install man # on-line reference manual
apt-get install gcc-doc # on-line reference manual for gcc
apt-get install gdb # GNU debugger
apt-get install git # revision control system
apt-get install libreadline-dev # a library used later
apt-get install libsdl2-dev # a library used later
apt-get install llvm llvm-dev # llvm project, which contains libraries used later
apt-get install llvm-11 llvm-11-dev # only for ubuntu20.04
但是执行apt-get install build-essential
会发现:
sudo apt install build-essentialReading package lists... DoneBuilding dependency tree... DoneReading state information... DoneSome packages could not be installed.
This may mean that you haverequested an impossible situation or if you are using the unstabledistribution that some required packages have not yet been createdor been moved out of Incoming.The following information may help to resolve the situation:
The following packages have unmet dependencies: g++-11 :
Depends: gcc-11-base (= 11.2.0-19ubuntu1) but 11.4.0-1ubuntu1~22.04 is to be installed
Depends: libstdc++-11-dev (= 11.2.0-19ubuntu1) but it is not going to be installed gcc-11 :
Depends: cpp-11 (= 11.2.0-19ubuntu1) but 11.4.0-1ubuntu1~22.04 is to be installed
Depends: gcc-11-base (= 11.2.0-19ubuntu1) but 11.4.0-1ubuntu1~22.04 is to be installed
Depends: libcc1-0 (>= 11.2.0-19ubuntu1) but it is not going to be installed
Depends: libgcc-11-dev (= 11.2.0-19ubuntu1) but it is not going to be installed libc6-dev :
Depends: libc6 (= 2.35-0ubuntu3) but 2.35-0ubuntu3.6 is to be installed
Depends: libtirpc-dev but it is not going to be installed
Depends: libnsl-dev but it is not going to be installed
并且底下的命令重复执行两遍都不起作用,说明是每个软件包的依赖出错都有一些不同。
感谢CSDN上空が笑っています的文章。解决方法是使用能够更好地解决依赖关系的aptitude去安装:
sudo apt install aptitude
sudo aptitude install build-essential
# 然后在第一个问题中选择第二个选项n
# 在第二、三个问题中选择y
# 后面这些也是如法炮制
sudo aptitude install libreadline-dev
sudo aptitude install libsdl2-dev
sudo aptitude install llvm llvm-dev
# 这个直接选y
sudo aptitude install llvm-11 llvm-11-dev
安装vim:
# vim的安装同样遇到了依赖版本问题。如下解决:
sudo aptitude install vim
vim test
尝试使用man:
man man