无法安装特定版本的 gcc-mingw

无法安装特定版本的 gcc-mingw

我需要 gcc-mingw-w64 版本 9.3.0 才能正确编译项目。我正在运行 hirsute。对于此版本,gcc-mingw-w64 版本是 10.0 左右。我已经添加archive.ubuntu.org focal到我的sources.list。但是当我运行sudo apt update然后sudo apt install gcc-mingw-w64=9.3.0-7ubuntu1+22~exp1ubuntu4 -s依赖包仍然从 hirsute repo 安装:

...
    Inst binutils-mingw-w64-i686 (2.35.1-2ubuntu1+8.11 Ubuntu:21.04/hirsute [amd64])
    Inst mingw-w64-common (8.0.0-1 Ubuntu:21.04/hirsute [all])
    Inst mingw-w64-i686-dev (8.0.0-1 Ubuntu:21.04/hirsute [all])
    Inst gcc-mingw-w64-base (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-i686-posix-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-i686-posix (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-i686-win32-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-i686-win32 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst binutils-mingw-w64-x86-64 (2.35.1-2ubuntu1+8.11 Ubuntu:21.04/hirsute [amd64])
    Inst mingw-w64-x86-64-dev (8.0.0-1 Ubuntu:21.04/hirsute [all])
    Inst gcc-mingw-w64-x86-64-posix-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-x86-64-posix (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-x86-64-win32-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-x86-64-win32 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Inst gcc-mingw-w64-i686 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [all])
    Inst gcc-mingw-w64-x86-64 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [all])
    Inst gcc-mingw-w64 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [all])
    Conf binutils-mingw-w64-i686 (2.35.1-2ubuntu1+8.11 Ubuntu:21.04/hirsute [amd64])
    Conf mingw-w64-common (8.0.0-1 Ubuntu:21.04/hirsute [all])
    Conf mingw-w64-i686-dev (8.0.0-1 Ubuntu:21.04/hirsute [all])
    Conf gcc-mingw-w64-base (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-i686-posix-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-i686-posix (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-i686-win32-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-i686-win32 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf binutils-mingw-w64-x86-64 (2.35.1-2ubuntu1+8.11 Ubuntu:21.04/hirsute [amd64])
    Conf mingw-w64-x86-64-dev (8.0.0-1 Ubuntu:21.04/hirsute [all])
    Conf gcc-mingw-w64-x86-64-posix-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-x86-64-posix (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-x86-64-win32-runtime (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-x86-64-win32 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [amd64])
    Conf gcc-mingw-w64-i686 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [all])
    Conf gcc-mingw-w64-x86-64 (10.3.0-1ubuntu1+24.1build1 Ubuntu:21.04/hirsute [all])
    Conf gcc-mingw-w64 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [all])
    zm@pop-os:~$ 

我怎样才能解决这个问题?

答案1

你正在朝着正确的方向前进,但忘了两件事——添加主要的放置焦点和供给物的口袋-t=target_release 选项至 APT。

完整的解决方案如下:

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ focal main universe"
sudo apt install gcc-mingw-w64=9.3.0-7ubuntu1+22~exp1ubuntu4 -s -t focal

注意:-s应该被删除,因为我们现在有正确的包来源:

Inst libisl22 (0.22.1-1 Ubuntu:20.04/focal [amd64])
Inst binutils-mingw-w64-i686 (2.34-5ubuntu1+8.8 Ubuntu:20.04/focal [amd64])
Inst binutils-mingw-w64-x86-64 (2.34-5ubuntu1+8.8 Ubuntu:20.04/focal [amd64])
Inst mingw-w64-common (7.0.0-2 Ubuntu:20.04/focal [all])
Inst mingw-w64-i686-dev (7.0.0-2 Ubuntu:20.04/focal [all])
Inst gcc-mingw-w64-base (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [amd64])
Inst gcc-mingw-w64-i686 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [amd64])
Inst mingw-w64-x86-64-dev (7.0.0-2 Ubuntu:20.04/focal [all])
Inst gcc-mingw-w64-x86-64 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [amd64])
Inst gcc-mingw-w64 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [all])
Conf libisl22 (0.22.1-1 Ubuntu:20.04/focal [amd64])
Conf binutils-mingw-w64-i686 (2.34-5ubuntu1+8.8 Ubuntu:20.04/focal [amd64])
Conf binutils-mingw-w64-x86-64 (2.34-5ubuntu1+8.8 Ubuntu:20.04/focal [amd64])
Conf mingw-w64-common (7.0.0-2 Ubuntu:20.04/focal [all])
Conf mingw-w64-i686-dev (7.0.0-2 Ubuntu:20.04/focal [all])
Conf gcc-mingw-w64-base (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [amd64])
Conf gcc-mingw-w64-i686 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [amd64])
Conf mingw-w64-x86-64-dev (7.0.0-2 Ubuntu:20.04/focal [all])
Conf gcc-mingw-w64-x86-64 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [amd64])
Conf gcc-mingw-w64 (9.3.0-7ubuntu1+22~exp1ubuntu4 Ubuntu:20.04/focal [all])

相关内容