【Linux环境配置】使用aptitude解决Ubuntu安装libsdl2-dev提示的unmet dependencies依赖不满足错误问题

本文主要是介绍【Linux环境配置】使用aptitude解决Ubuntu安装libsdl2-dev提示的unmet dependencies依赖不满足错误问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文章目录

  • 1. 问题现象
  • 2. 分步手动解决方案
    • 2.1 安装 `aptitude` 工具
    • 2.2 使用 `aptitude` 工具手动解决部分依赖关系
  • 2.3 再次检查依赖关系
    • 2.4 再次使用 `aptitude` 工具解决剩余的依赖, 降级到合适的版本即可;
    • 2.5 检查需要的库 `libsdl2-dev` 已经成功安装
  • 3. 其他备用修复措施

1. 问题现象

  • 已经安装的库文件版本太新, 依赖不满足, 导致无法安装新软件
$ sudo apt-get install libsdl2-dev 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:The following packages have unmet dependencies:libpulse-dev : Depends: libpulse0 (= 1:15.99.1+dfsg1-1ubuntu1) but 1:15.99.1+dfsg1-1ubuntu2.1 is to be installedDepends: libpulse-mainloop-glib0 (= 1:15.99.1+dfsg1-1ubuntu1) but 1:15.99.1+dfsg1-1ubuntu2.1 is to be installedlibudev-dev : Depends: libudev1 (= 249.11-0ubuntu3.7) but 249.11-0ubuntu3.11 is to be installed
E: Unable to correct problems, you have held broken packages.

2. 分步手动解决方案

2.1 安装 aptitude 工具

# 先安装工具 aptitude
$ sudo aptitude install aptitude

2.2 使用 aptitude 工具手动解决部分依赖关系

# 使用aptitude再次执行安装, 先安装上面依赖的一个库
$ sudo aptitude install libudev-dev
The following NEW packages will be installed:libudev-dev{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.7 kB of archives. After unpacking 270 kB will be used.
The following packages have unmet dependencies:libudev-dev : Depends: libudev1 (= 249.11-0ubuntu3.7) but 249.11-0ubuntu3.11 is installed
The following actions will resolve these dependencies:Keep the following packages at their current version:
1)     libudev-dev [Not Installed]                        # 注意下面这行, 选择 `n` 否决上面的 不安装方案, 让工具提示其他方案;
Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:Remove the following packages:                                            
1)      udev [249.11-0ubuntu3.11 (now)]                                         Install the following packages:                                           
2)      gcc-12-base:i386 [12.3.0-1ubuntu1~22.04 (jammy-security)]               
3)      krb5-locales [1.19.2-2ubuntu0.3 (jammy-security)]                       
4)      libacl1:i386 [2.3.1-1 (jammy)]                                          
5)      libblkid1:i386 [2.37.2-4ubuntu3 (jammy)]                                
6)      libc6:i386 [2.35-0ubuntu3.6 (jammy-security)]                           
7)      libcap2:i386 [1:2.44-1ubuntu0.22.04.1 (jammy-security)]                 
8)      libcom-err2:i386 [1.46.5-2ubuntu1.1 (jammy-security)]                   
9)      libcrypt1:i386 [1:4.4.27-1 (jammy)]                                     
10)     libgcc-s1:i386 [12.3.0-1ubuntu1~22.04 (jammy-security)]                 
11)     libgssapi-krb5-2:i386 [1.19.2-2ubuntu0.3 (jammy-security)]              
12)     libidn2-0:i386 [2.3.2-2build1 (jammy)]                                  
13)     libk5crypto3:i386 [1.19.2-2ubuntu0.3 (jammy-security)]                  
14)     libkeyutils1:i386 [1.6.1-2ubuntu3 (jammy)]                              
15)     libkmod2:i386 [29-1ubuntu1 (jammy)]                                     
16)     libkrb5-3:i386 [1.19.2-2ubuntu0.3 (jammy-security)]                     
17)     libkrb5support0:i386 [1.19.2-2ubuntu0.3 (jammy-security)]               
18)     liblzma5:i386 [5.2.5-2ubuntu1 (jammy)]                                  
19)     libnsl2:i386 [1.3.0-2build2 (jammy)]                                    
20)     libnss-nis:i386 [3.1-0ubuntu6 (jammy)]                                  
21)     libnss-nisplus:i386 [1.3-0ubuntu6 (jammy)]                              
22)     libpcre2-8-0:i386 [10.39-3ubuntu0.1 (jammy-security)]                   
23)     libselinux1:i386 [3.3-1build2 (jammy)]                                  
24)     libssl3:i386 [3.0.2-0ubuntu1.12 (jammy-security)]                       
25)     libtirpc3:i386 [1.3.2-2ubuntu0.1 (jammy-security)]                      
26)     libudev1:i386 [249.11-0ubuntu3.7 (jammy-security)]                      
27)     libunistring2:i386 [1.0-1 (jammy)]                                      
28)     libzstd1:i386 [1.4.8+dfsg-3build1 (jammy)]                              
29)     udev:i386 [249.11-0ubuntu3.7 (jammy-security)]                          Downgrade the following packages:                                         
30)     libudev1 [249.11-0ubuntu3.11 (now) -> 249.11-0ubuntu3.7 (jammy-security)Leave the following dependencies unresolved:                              
31)     udev:i386 recommends systemd-hwe-hwdb:i386                              # 这里选择方案29或者30看起来都是安装 249.11-0ubuntu3.7 这个版本;
Accept this solution? [Y/n/q/?] 30
Action "30": Installing libudev1 249.11-0ubuntu3.7 (jammy-security)Package: libudev1
Version: 249.11-0ubuntu3.7
State: installed (249.11-0ubuntu3.11), upgrade available (249.11-0ubuntu3.7)
Automatically installed: no
Multi-Arch: same
Priority: required
Section: libs
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 354 k
Depends: libc6 (>= 2.34)
Breaks: libudev1:i386 (!= 249.11-0ubuntu3.7)
Replaces: libudev1:i386 (< 249.11-0ubuntu3.7)
Description: libudev shared libraryThis library provides access to udev device information.
Homepage: https://www.freedesktop.org/wiki/Software/systemdThis action was selected because libudev-dev depends upon libudev1 (=
249.11-0ubuntu3.7).Enter "r 30" to prevent this action from appearing in new solutions.
Enter "a 30" to require that new solutions include this action if possible.# 后面就是一路敲回车自动处理了;
Accept this solution? [Y/n/q/?] 
The following packages will be DOWNGRADED:libudev1 
The following NEW packages will be installed:gcc-12-base:i386{a} krb5-locales{a} libacl1:i386{a} libblkid1:i386{a} libc6:i386{a} libcap2:i386{a} libcom-err2:i386{a} libcrypt1:i386{a} libgcc-s1:i386{a} libgssapi-krb5-2:i386{a} libidn2-0:i386{a} libk5crypto3:i386{a} libkeyutils1:i386{a} libkmod2:i386{a} libkrb5-3:i386{a} libkrb5support0:i386{a} liblzma5:i386{a} libnsl2:i386{a} libnss-nis:i386{a} libnss-nisplus:i386{a} libpcre2-8-0:i386{a} libselinux1:i386{a} libssl3:i386{a} libtirpc3:i386{a} libudev-dev libudev1:i386{a} libunistring2:i386{a} libzstd1:i386{a} udev:i386{a} 
The following packages will be REMOVED:systemd-hwe-hwdb{u} udev{a} 
0 packages upgraded, 29 newly installed, 1 downgraded, 2 to remove and 0 not upgraded.
Need to get 9,395 kB of archives. After unpacking 27.9 MB will be used.
Do you want to continue? [Y/n/?] 
Get: 1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security/main i386 gcc-12-base i386 12.3.0-1ubuntu1~22.04 [20.1 kB]

2.3 再次检查依赖关系

  • 说明 : 此处的目的是看前面的步骤是否成功, 理论上也可以依次解决多个依赖, 但是不好观察, 所以本文分步一个个解决, 稳扎稳打, 免得把系统搞得乱七八糟;
$ sudo apt-get install libsdl2-dev 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:The following packages have unmet dependencies:libpulse-dev : Depends: libpulse0 (= 1:15.99.1+dfsg1-1ubuntu1) but 1:15.99.1+dfsg1-1ubuntu2.1 is to be installedDepends: libpulse-mainloop-glib0 (= 1:15.99.1+dfsg1-1ubuntu1) but 1:15.99.1+dfsg1-1ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.
  • 从上面的日志来开, 本文开头的两个依赖错误解决了一个, 剩余另一个 libpulse-dev, 这个依赖于 1:15.99.1+dfsg1-1ubuntu1 这个版本, 但是安装了较新的另一个版本 1:15.99.1+dfsg1-1ubuntu2.1, 看来还是要做一次降级;

2.4 再次使用 aptitude 工具解决剩余的依赖, 降级到合适的版本即可;

  • 详见日志中的 选择即可;
$ sudo aptitude install libsdl2-dev 
The following NEW packages will be installed:libasound2-dev{a} libblkid-dev{a} libdbus-1-dev{a} libdecor-0-0{a} libdecor-0-plugin-1-cairo{a} libegl-dev{a} libegl1-mesa-dev{a} libgl-dev{a} libgles-dev{a} libgles1{a} libglib2.0-dev{a} libglib2.0-dev-bin{a} libglu1-mesa-dev{a} libglvnd-core-dev{a} libglvnd-dev{a} libglx-dev{a} libibus-1.0-dev{a} libice-dev{a} libmount-dev{a} libopengl-dev{a} libpcre16-3{a} libpcre2-dev{a} libpcre2-posix3{a} libpcre3-dev{a} libpcre32-3{a} libpcrecpp0v5{a} libpthread-stubs0-dev{a} libsdl2-2.0-0{a} libsdl2-dev{b} libselinux1-dev{a} libsepol-dev{a} libsm-dev{a} libsndio-dev{a} libwayland-bin{a} libwayland-dev{a} libx11-dev{a} libxau-dev{a} libxcb1-dev{a} libxcursor-dev{a} libxdmcp-dev{a} libxext-dev{a} libxfixes-dev{a} libxi-dev{a} libxinerama-dev{a} libxkbcommon-dev{a} libxrandr-dev{a} libxrender-dev{a} libxss-dev{a} libxt-dev{a} libxv-dev{a} libxxf86vm-dev{a} uuid-dev{a} x11proto-dev{a} xorg-sgml-doctools{a} xtrans-dev{a} 
0 packages upgraded, 55 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.2 MB of archives. After unpacking 50.7 MB will be used.
The following packages have unmet dependencies:libsdl2-dev : Depends: libpulse-dev but it is not installable
The following actions will resolve these dependencies:Keep the following packages at their current version:
1)     libsdl2-dev [Not Installed]                        Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:Install the following packages:                                                                     
1)     libpulse-dev [1:15.99.1+dfsg1-1ubuntu1 (jammy)]                                                   Downgrade the following packages:                                                                   
2)     libpulse-mainloop-glib0 [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]    
3)     libpulse0 [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]                  
4)     libpulsedsp [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]                
5)     pulseaudio [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]                 
6)     pulseaudio-module-bluetooth [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]
7)     pulseaudio-module-gsettings [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]
8)     pulseaudio-utils [1:15.99.1+dfsg1-1ubuntu2.1 (now) -> 1:15.99.1+dfsg1-1ubuntu1 (jammy)]           Accept this solution? [Y/n/q/?] 1
Action "1": Installing libpulse-dev 1:15.99.1+dfsg1-1ubuntu1 (jammy)Package: libpulse-dev
Version: 1:15.99.1+dfsg1-1ubuntu1
State: not installed
Multi-Arch: same
Priority: optional
Section: libdevel
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 557 k
Depends: libpulse0 (= 1:15.99.1+dfsg1-1ubuntu1), libpulse-mainloop-glib0 (= 1:15.99.1+dfsg1-1ubuntu1), libglib2.0-dev
Breaks: libpulse-dev:i386 (!= 1:15.99.1+dfsg1-1ubuntu1)
Replaces: libpulse-dev:i386 (< 1:15.99.1+dfsg1-1ubuntu1)
Description: PulseAudio client development headers and librariesPulseAudio, previously known as Polypaudio, is a sound server for POSIX and WIN32 systems. It is a drop in replacement for the ESD sound server with much better latency, mixing/re-sampling quality andoverall architecture. Headers and libraries for developing applications that access a PulseAudio sound server via PulseAudio's native interface.
Homepage: http://www.pulseaudio.orgThis action was selected because libsdl2-dev depends upon libpulse-dev.Enter "r 1" to prevent this action from appearing in new solutions.
Enter "a 1" to require that new solutions include this action if possible.Accept this solution? [Y/n/q/?] 
The following packages will be DOWNGRADED:libpulse-mainloop-glib0 libpulse0 libpulsedsp pulseaudio pulseaudio-module-bluetooth pulseaudio-module-gsettings pulseaudio-utils 
The following NEW packages will be installed:

2.5 检查需要的库 libsdl2-dev 已经成功安装

$ sudo aptitude install libsdl2-dev 
libsdl2-dev is already installed at the requested version (2.0.20+dfsg-2build1)
libsdl2-dev is already installed at the requested version (2.0.20+dfsg-2build1)
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

3. 其他备用修复措施

如果直接自动修复能解决, 那就解决, 如果是类似于本文的, 已经安装了较新版本的, 一般都要仔细观察, 然后对已安装的进行版本降级处理才行哟;

  • first step
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade
  • second step
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
  • third step
sudo apt --fix-broken install
sudo apt-get update && sudo apt-get upgrade
sudo dpkg --configure -a
sudo apt-get install -f

这篇关于【Linux环境配置】使用aptitude解决Ubuntu安装libsdl2-dev提示的unmet dependencies依赖不满足错误问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/652153

相关文章

springboot整合 xxl-job及使用步骤

《springboot整合xxl-job及使用步骤》XXL-JOB是一个分布式任务调度平台,用于解决分布式系统中的任务调度和管理问题,文章详细介绍了XXL-JOB的架构,包括调度中心、执行器和Web... 目录一、xxl-job是什么二、使用步骤1. 下载并运行管理端代码2. 访问管理页面,确认是否启动成功

最新版IDEA配置 Tomcat的详细过程

《最新版IDEA配置Tomcat的详细过程》本文介绍如何在IDEA中配置Tomcat服务器,并创建Web项目,首先检查Tomcat是否安装完成,然后在IDEA中创建Web项目并添加Web结构,接着,... 目录配置tomcat第一步,先给项目添加Web结构查看端口号配置tomcat    先检查自己的to

使用Nginx来共享文件的详细教程

《使用Nginx来共享文件的详细教程》有时我们想共享电脑上的某些文件,一个比较方便的做法是,开一个HTTP服务,指向文件所在的目录,这次我们用nginx来实现这个需求,本文将通过代码示例一步步教你使用... 在本教程中,我们将向您展示如何使用开源 Web 服务器 Nginx 设置文件共享服务器步骤 0 —

解决mybatis-plus-boot-starter与mybatis-spring-boot-starter的错误问题

《解决mybatis-plus-boot-starter与mybatis-spring-boot-starter的错误问题》本文主要讲述了在使用MyBatis和MyBatis-Plus时遇到的绑定异常... 目录myBATis-plus-boot-starpythonter与mybatis-spring-b

Java中switch-case结构的使用方法举例详解

《Java中switch-case结构的使用方法举例详解》:本文主要介绍Java中switch-case结构使用的相关资料,switch-case结构是Java中处理多个分支条件的一种有效方式,它... 目录前言一、switch-case结构的基本语法二、使用示例三、注意事项四、总结前言对于Java初学者

Linux内核之内核裁剪详解

《Linux内核之内核裁剪详解》Linux内核裁剪是通过移除不必要的功能和模块,调整配置参数来优化内核,以满足特定需求,裁剪的方法包括使用配置选项、模块化设计和优化配置参数,图形裁剪工具如makeme... 目录简介一、 裁剪的原因二、裁剪的方法三、图形裁剪工具四、操作说明五、make menuconfig

Golang使用minio替代文件系统的实战教程

《Golang使用minio替代文件系统的实战教程》本文讨论项目开发中直接文件系统的限制或不足,接着介绍Minio对象存储的优势,同时给出Golang的实际示例代码,包括初始化客户端、读取minio对... 目录文件系统 vs Minio文件系统不足:对象存储:miniogolang连接Minio配置Min

使用Python绘制可爱的招财猫

《使用Python绘制可爱的招财猫》招财猫,也被称为“幸运猫”,是一种象征财富和好运的吉祥物,经常出现在亚洲文化的商店、餐厅和家庭中,今天,我将带你用Python和matplotlib库从零开始绘制一... 目录1. 为什么选择用 python 绘制?2. 绘图的基本概念3. 实现代码解析3.1 设置绘图画

使用Python实现大文件切片上传及断点续传的方法

《使用Python实现大文件切片上传及断点续传的方法》本文介绍了使用Python实现大文件切片上传及断点续传的方法,包括功能模块划分(获取上传文件接口状态、临时文件夹状态信息、切片上传、切片合并)、整... 目录概要整体架构流程技术细节获取上传文件状态接口获取临时文件夹状态信息接口切片上传功能文件合并功能小

Golang使用etcd构建分布式锁的示例分享

《Golang使用etcd构建分布式锁的示例分享》在本教程中,我们将学习如何使用Go和etcd构建分布式锁系统,分布式锁系统对于管理对分布式系统中共享资源的并发访问至关重要,它有助于维护一致性,防止竞... 目录引言环境准备新建Go项目实现加锁和解锁功能测试分布式锁重构实现失败重试总结引言我们将使用Go作