如何安全地将 gcc 从 8.5 降级到 8.4?

如何安全地将 gcc 从 8.5 降级到 8.4?

我有一台 CentOS Stream 8 服务器,其中有一个备份应用程序,需要使用相同版本的内核进行编译gcc。最新内核是:4.18.0-408.el8.x86_64

gcc在进行更新的过程中不小心更新了,目前是:gcc version 8.5.0 20210514 (Red Hat 8.5.0-15) (GCC)

gcc8.5 显然从 CentOS Stream 9 移植到了 8,这给我带来了问题。

我需要降级gcc到可用的 8.4。当然,当我尝试时,我收到以下错误:

]# dnf install gcc-8.4.1-1.el8.x86_64
Last metadata expiration check: 0:09:42 ago on Fri 28 Oct 2022 12:15:53 AM PDT.
Error:
 Problem: problem with installed package gcc-plugin-annobin-8.5.0-15.el8.x86_64
  - package gcc-plugin-annobin-8.5.0-15.el8.x86_64 requires gcc = 8.5.0-15.el8, but none of the providers can be installed
  - package gcc-plugin-annobin-8.5.0-13.el8.x86_64 requires gcc = 8.5.0-13.el8, but none of the providers can be installed
  - package gcc-plugin-annobin-8.5.0-14.el8.x86_64 requires gcc = 8.5.0-14.el8, but none of the providers can be installed
  - cannot install both gcc-8.4.1-1.el8.x86_64 and gcc-8.5.0-15.el8.x86_64
  - cannot install both gcc-8.5.0-13.el8.x86_64 and gcc-8.4.1-1.el8.x86_64
  - cannot install both gcc-8.5.0-14.el8.x86_64 and gcc-8.4.1-1.el8.x86_64
  - cannot install both gcc-8.5.0-15.el8.x86_64 and gcc-8.4.1-1.el8.x86_64
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
]# dnf remove gcc
Dependencies resolved.
===========================================================================================================================================================================
 Package                                           Architecture                      Version                                   Repository                             Size
===========================================================================================================================================================================
Removing:
 gcc                                               x86_64                            8.5.0-15.el8                              @appstream                             59 M
Removing dependent packages:
 BackupAndRecoveryAgent                            x86_64                            15.0.30430-1                              @System                               933 M
 annobin                                           x86_64                            10.67-3.el8                               @appstream                            968 k
 dkms                                              noarch                            3.0.7-1.el8                               @epel                                 151 k
 file_protector                                    noarch                            1.1-1497                                  @System                               8.3 M
 gcc-plugin-annobin                                x86_64                            8.5.0-15.el8                              @appstream                             48 k
 snapapi26_modules                                 noarch                            0.8.15-1                                  @System                               5.2 M
Removing unused dependencies:
 cpp                                               x86_64                            8.5.0-15.el8                              @appstream                             28 M
 glibc-devel                                       x86_64                            2.28-214.el8                              @baseos                               234 k
 glibc-headers                                     x86_64                            2.28-214.el8                              @baseos                               1.9 M
 isl                                               x86_64                            0.16.1-6.el8                              @AppStream                            3.1 M
 kernel-headers                                    x86_64                            4.18.0-408.el8                            @baseos                               5.2 M
 libmpc                                            x86_64                            1.1.0-9.1.el8                             @appstream                            124 k
 libxcrypt-devel                                   x86_64                            4.1.1-6.el8                               @baseos                                24 k

Transaction Summary
===========================================================================================================================================================================
Remove  14 Packages

我应该删除dnf remove gcc-plugin-annobindnf install gcc-8.4.1-1.el8.x86_64 --skip-broken安装吗?安装 8.4 后一切都会顺利吗?还是我应该删除gccgcc-plugin-annobin安装我需要的版本?

我只是想小心谨慎,以免发生任何意外。

谢谢。

答案1

我可以通过使用来解决这个问题--allowerasing

]# dnf install gcc-8.4.1-1.el8.x86_64 --allowerasing删除 gcc 8.5 并安装 8.4

相关内容