【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

相关文章

Java使用jar命令配置服务器端口的完整指南

《Java使用jar命令配置服务器端口的完整指南》本文将详细介绍如何使用java-jar命令启动应用,并重点讲解如何配置服务器端口,同时提供一个实用的Web工具来简化这一过程,希望对大家有所帮助... 目录1. Java Jar文件简介1.1 什么是Jar文件1.2 创建可执行Jar文件2. 使用java

C#使用Spire.Doc for .NET实现HTML转Word的高效方案

《C#使用Spire.Docfor.NET实现HTML转Word的高效方案》在Web开发中,HTML内容的生成与处理是高频需求,然而,当用户需要将HTML页面或动态生成的HTML字符串转换为Wor... 目录引言一、html转Word的典型场景与挑战二、用 Spire.Doc 实现 HTML 转 Word1

Vue3绑定props默认值问题

《Vue3绑定props默认值问题》使用Vue3的defineProps配合TypeScript的interface定义props类型,并通过withDefaults设置默认值,使组件能安全访问传入的... 目录前言步骤步骤1:使用 defineProps 定义 Props步骤2:设置默认值总结前言使用T

Java中的抽象类与abstract 关键字使用详解

《Java中的抽象类与abstract关键字使用详解》:本文主要介绍Java中的抽象类与abstract关键字使用详解,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友跟随小编一起看看吧... 目录一、抽象类的概念二、使用 abstract2.1 修饰类 => 抽象类2.2 修饰方法 => 抽象方法,没有

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

Vite 打包目录结构自定义配置小结

《Vite打包目录结构自定义配置小结》在Vite工程开发中,默认打包后的dist目录资源常集中在asset目录下,不利于资源管理,本文基于Rollup配置原理,本文就来介绍一下通过Vite配置自定义... 目录一、实现原理二、具体配置步骤1. 基础配置文件2. 配置说明(1)js 资源分离(2)非 JS 资

MyBatis ParameterHandler的具体使用

《MyBatisParameterHandler的具体使用》本文主要介绍了MyBatisParameterHandler的具体使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参... 目录一、概述二、源码1 关键属性2.setParameters3.TypeHandler1.TypeHa

Spring 中的切面与事务结合使用完整示例

《Spring中的切面与事务结合使用完整示例》本文给大家介绍Spring中的切面与事务结合使用完整示例,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考... 目录 一、前置知识:Spring AOP 与 事务的关系 事务本质上就是一个“切面”二、核心组件三、完

使用docker搭建嵌入式Linux开发环境

《使用docker搭建嵌入式Linux开发环境》本文主要介绍了使用docker搭建嵌入式Linux开发环境,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录1、前言2、安装docker3、编写容器管理脚本4、创建容器1、前言在日常开发全志、rk等不同

MySQL8 密码强度评估与配置详解

《MySQL8密码强度评估与配置详解》MySQL8默认启用密码强度插件,实施MEDIUM策略(长度8、含数字/字母/特殊字符),支持动态调整与配置文件设置,推荐使用STRONG策略并定期更新密码以提... 目录一、mysql 8 密码强度评估机制1.核心插件:validate_password2.密码策略级