Ubuntu系统安装 git及过程报错解决

一、下载安装包

  1. 下载Linux下的Git安装包,地址:

https://mirrors.edge.kernel.org/pub/software/scm/git/
  1. 将下载的压缩包上传至Linux服务器的/usr目录下面

  1. 进入到/usr目录下:cd /usr

  1. 解压压缩包:

tar -zxvf git-2.9.5.tar.gz

5.进入到解压后的文件夹:

cd git-2.9.5

6. 编译Git源码:

make prefix=/usr/local/git all

7.安装Git到/usr/local/git路径:

make prefix=/usr/local/git install

8. 配置环境变量:

sudo vi /etc/profile

9.在环境变量配置文件最后加上:

export PATH=$PATH:/usr/local/git/bin

10. 刷新环境变量:

source /etc/profile

11. 查看Git是否安装完成:

git --version

二、安装过程报错解决

  1. fatal error: openssl/ssl.h: No such file or directory

解决方法:

sudo apt-get install libssl-dev

提示界面如下:

问题现象:

在安装libssl-dev 的时候提示错误:

解决方法:

linux的版本依赖问题很令人纠结,不过我们可以通过使用aptitude软件包管理器来解决这个依赖问题,aptitude是可以选择合适的版本与匹配软件安装。

首先安装aptitude工具

sudo apt-get install aptitude

再利用aptitude来安装libssl-dev

sudo aptitude install libssl-dev
sqtu@ubuntu:/usr/git-2.9.5$ sudo aptitude install libssl-dev
The following NEW packages will be installed:
  libssl-dev{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 36 not upgraded.
Need to get 1,372 kB of archives. After unpacking 6,863 kB will be used.
The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.0g-2ubuntu4) but 1.1.1-1ubuntu2.1~18.04.6 is installed
The following actions will resolve these dependencies:
 
     Keep the following packages at their current version:
1)     libssl-dev [Not Installed]                         
 
 
 
Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:
 
     Upgrade the following packages:                                            
1)     libmysqlclient20 [5.7.30-0ubuntu0.18.04.1 (now) -> 5.7.33-0ubuntu0.16.04.
 
     Downgrade the following packages:                                          
2)     libpython2.7 [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)]      
3)     libpython2.7-minimal [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic
4)     libpython2.7-stdlib [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)
5)     libssl1.1 [1.1.1-1ubuntu2.1~18.04.6 (now) -> 1.1.0g-2ubuntu4 (bionic)]   
6)     python2.7 [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)]         
7)     python2.7-minimal [2.7.17-1~18.04ubuntu1 (now) -> 2.7.15~rc1-1 (bionic)] 
 
 
 
Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libpython2.7 libpython2.7-minimal libpython2.7-stdlib libssl1.1 python2.7 
  python2.7-minimal 
The following NEW packages will be installed:
  libssl-dev 
The following packages will be upgraded:
  libmysqlclient20 
1 packages upgraded, 1 newly installed, 6 downgraded, 0 to remove and 35 not upgraded.
Need to get 8,010 kB of archives. After unpacking 6,265 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libmysqlclient20 amd64 5.7.33-0ubuntu0.16.04.1 [684 kB]
Get: 2 http://archive.ubuntu.com/ubuntu bionic/main amd64 python2.7 amd64 2.7.15~rc1-1 [238 kB]
Get: 3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7 amd64 2.7.15~rc1-1 [1,053 kB]
Get: 4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7-stdlib amd64 2.7.15~rc1-1 [1,910 kB]
Get: 5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libssl1.1 amd64 1.1.0g-2ubuntu4 [1,128 kB]
Get: 6 http://archive.ubuntu.com/ubuntu bionic/main amd64 python2.7-minimal amd64 2.7.15~rc1-1 [1,292 kB]
Get: 7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpython2.7-minimal amd64 2.7.15~rc1-1 [334 kB]
Get: 8 http://archive.ubuntu.com/ubuntu bionic/main amd64 libssl-dev amd64 1.1.0g-2ubuntu4 [1,372 kB]
Fetched 8,010 kB in 8s (1,045 kB/s)                                             
Preconfiguring packages ...
dpkg: warning: downgrading python2.7 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1
(Reading database ... 142514 files and directories currently installed.)
Preparing to unpack .../0-python2.7_2.7.15~rc1-1_amd64.deb ...
Unpacking python2.7 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ...
dpkg: warning: downgrading libpython2.7:amd64 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1
Preparing to unpack .../1-libpython2.7_2.7.15~rc1-1_amd64.deb ...
Unpacking libpython2.7:amd64 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ...
Preparing to unpack .../2-libmysqlclient20_5.7.33-0ubuntu0.16.04.1_amd64.deb ...
Unpacking libmysqlclient20:amd64 (5.7.33-0ubuntu0.16.04.1) over (5.7.30-0ubuntu0.18.04.1) ...
dpkg: warning: downgrading libpython2.7-stdlib:amd64 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1
Preparing to unpack .../3-libpython2.7-stdlib_2.7.15~rc1-1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ...
dpkg: warning: downgrading libssl1.1:amd64 from 1.1.1-1ubuntu2.1~18.04.6 to 1.1.0g-2ubuntu4
Preparing to unpack .../4-libssl1.1_1.1.0g-2ubuntu4_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.0g-2ubuntu4) over (1.1.1-1ubuntu2.1~18.04.6) ...
dpkg: warning: downgrading python2.7-minimal from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1
Preparing to unpack .../5-python2.7-minimal_2.7.15~rc1-1_amd64.deb ...
Unpacking python2.7-minimal (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ...
dpkg: warning: downgrading libpython2.7-minimal:amd64 from 2.7.17-1~18.04ubuntu1 to 2.7.15~rc1-1
Preparing to unpack .../6-libpython2.7-minimal_2.7.15~rc1-1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.15~rc1-1) over (2.7.17-1~18.04ubuntu1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../7-libssl-dev_1.1.0g-2ubuntu4_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.0g-2ubuntu4) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up libssl1.1:amd64 (1.1.0g-2ubuntu4) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up libmysqlclient20:amd64 (5.7.33-0ubuntu0.16.04.1) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.15~rc1-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.15~rc1-1) ...
Setting up python2.7-minimal (2.7.15~rc1-1) ...
Setting up libssl-dev:amd64 (1.1.0g-2ubuntu4) ...
Setting up python2.7 (2.7.15~rc1-1) ...
Setting up libpython2.7:amd64 (2.7.15~rc1-1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
                                         
Current status: 35 (-1) upgradable.

至此,问题解决,以后遇到版本不对导致依赖不对应的问题也可以采用上述的方法进行解决。

  1. fatal error: zlib.h: No such file or directory

解决方法:

sudo apt-get install zlib1g-dev

  1. fatal error: curl/curl.h: No such file or directory

解决方法:

sudo apt-get install libcurl4-openssl-dev

  1. fatal error: expat.h: No such file or directory

解决方法:

sudo apt-get install libexpat1-dev

  1. MSGFMT po/pt_pt.msg Makefile:254: recipe for target 'po/pt_pt.msg' failed

make[1]: *** [po/pt_pt.msg] Error 127

Makefile:2159: recipe for target 'all' failed

make: *** [all] Error 2

解决方法:

sudo apt install gettext

  1. cc: not found

解决方法:

sudo apt install gcc

### 解决 Ubuntu 18.04 上 Autoware 1.14 编译错误 当在 Ubuntu 18.04 上安装 Autoware 1.14 版本时,可能会遇到各种编译错误。这些错误通常由依赖项缺失、环境变量未设置或软件包版本不兼容引起。 #### 常见的编译错误及其解决方案 #### CMake 配置失败 如果 `CMake` 报告找不到某些库文件,则可能是由于缺少必要的开发工具和库。建议先更新并安装基础构建工具: ```bash sudo apt update && sudo apt upgrade -y sudo apt install -y build-essential cmake git wget curl unzip pkg-config ``` 对于特定于计算机视觉处理所需的库,可以按照以下命令来确保所有必需组件都已就绪[^2]: ```bash sudo apt-get install -y \ libgtk2.0-dev \ libavcodec-dev \ libavformat-dev \ libjpeg-dev \ libtiff5-dev \ libswscale-dev \ libjasper-dev ``` #### ROS 和 Catkin 工具链问题 为了使 Autoware 能够顺利工作,在开始之前应确认已经正确设置了 ROS 环境以及 catkin 构建系统。这包括但不限于安装 Python 的一些辅助模块[^3]: ```bash sudo apt install -y python-catkin-pkg python-rosdep ros-melodic-catkin sudo apt install -y python3-pip python3-colcon-common-extensions python3-setuptools python3-vcstool pip3 install -U setuptools ``` 另外,还需要初始化 rosdep 并同步最新的资源列表以便后续操作能够访问到最新发布的软件包信息: ```bash sudo rosdep init rosdep update ``` #### GPU 支持相关的问题 针对需要 CUDA 加速的应用场景,务必验证 NVIDIA 显卡驱动程序已被正确加载,并且通过 APT 安装了适当版本的 cuDNN 及其配套的 TensorFlow 或 PyTorch 组件。例如,要启用 caffe 使用 GPU 进行加速训练的话,可以通过如下方式完成部署[^1]: ```bash sudo apt install caffe-cuda ``` #### 处理具体编译报错提示 面对具体的编译错误消息时,应该仔细阅读其中的内容,特别是那些指出无法找到头文件路径或是链接器未能解析符号的地方。这类情况往往指向某个特定的第三方库尚未被正确引入项目之中。此时可尝试利用 `apt-file search` 来定位所需文件的位置,并据此调整项目的 include path 或 link flags 设置;也可以考虑直接从源码重新编译该外部依赖以获得更好的控制权。 最后提醒一点,保持系统的整体一致性非常重要——即尽量让各个部分所使用的 API/ABI 接口处于同一水平线上,避免因混杂不同年代的技术栈而导致难以预料的行为发生。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值