AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 767757
Accepted
eyoung100
eyoung100
Asked: 2024-01-26 06:57:07 +0800 CST2024-01-26 06:57:07 +0800 CST 2024-01-26 06:57:07 +0800 CST

Estou usando a distribuição $X que foi enviada com o compilador $Y, mas preciso da versão do compilador $Z

  • 772

Emitir

Esta pergunta e respostas contendo várias abordagens para resolvê-la surgem muitas vezes quase diariamente em nosso intercâmbio aqui. Se um resultado de pesquisa trouxe você aqui Bem-vindo! Se um comentário que deixei em sua pergunta tiver um link aqui, você pode assumir com segurança que sua pergunta pode ser adicionada à lista abaixo, pois se enquadra na mesma categoria:

  • Desacordo entre glib e gcc após o downgrade do gcc
  • Como posso fazer o downgrade para uma versão específica do gcc no Fedora 39?
  • Como posso instalar alguns compiladores gcc no arch linux?
  • Debian Bullseye: Instale gcc-11.4.0 e dependências

Essas são apenas quatro das muitas perguntas marcadas [gcc]com o downgrade do termo de pesquisa. Aqueles leitores/usuários com conhecimento suficiente para chegar primeiro à exchange quase sempre perguntam Como posso..." Aqueles leitores azarados que tentaram algo que falhou quase sempre têm a frase "Quebrou", ou "Acho que quebrei alguma coisa". esta pergunta e resposta, tentarei explicar Por que misturar compiladores quebra todos os Linux e, na resposta, fornecerei a maneira mais simples que conheço para corrigir o problema, que não causa quebra, mas custa um pouco de sobrecarga em termos de tempo e espaço para configuração. Como esta será uma pergunta e resposta contribuída pela comunidade, peço que você vote positivamente se gostar da minha abordagem.

Problema explicado

TLDR : Vá para Por que o downgrade dos compiladores causa problemas?

Usei a imagem abaixo duas ou três vezes aqui em várias respostas e sinto que ela fornece a todos nós um bom lugar para começar. Sei que é grande e, como tal, peço aos leitores que o abram em uma guia separada e apliquem zoom, etc., se desejarem.

Linha do tempo das distribuições Linux

Encontre sua distribuição nessa lista e continue lendo. Você notará que sua distribuição tem uma distribuição pai. OK, OK, eu sei que os leitores que usam as distribuições principais (aquelas na extremidade esquerda da linha do tempo) estão perguntando:

Estou usando um dos da extrema esquerda, então onde estão seus pais?

E agora chegamos ao cerne desta questão. Por exemplo, vamos preencher $Xe $Ya partir do meu título (Paciência Leitores, $Zestá chegando)

  • $X = Fedora 39
  • $Y = 13.2.1-6.fc39

Definições

  • Distribution (Quoting Wikipedia):

A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and often a package management system.

  • Package Management System (Quoting Again):

A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner

Knowing these two items helps us answer the Parent Distribution question, but unfortunately with another question: How Do the distribution maintainers create a distribution?

The Answer: All linux software minus the kernel is stored at and can be obtained from the GNU Software FTP Site in source code archives. All Linux Kernels are available for download in source code archives at The Linux Kernel Archives. In short, all Distributions begin from the same source code, including the parent distributions

Why Does Downgrading Compilers Cause Issues?

From the definition earlier, a distribution is a group or set of related software. This relation can be seen in your distribution's repository (or whatever else your distribution has chosen to name it).

At the time a new version (in our Example $X = Fedora 39) is made available the repository for that version is locked, specifically version locked, meaning that every package in that repository is now frozen in time. Once frozen it isn't altered. It can only live as long as the version is supported or die when the version is upgraded.

The tools required to build GCC are also in the now frozen repository. If a user attempts to upgrade or downgrade the GCC that was shipped in the frozen repository, the version locking would be broken if you were to succeed. To prevent the breakage from happening, your OS'es Package Manager prevents this.

Read my answer to find out how I overcame $Z

package-management
  • 2 2 respostas
  • 105 Views

2 respostas

  • Voted
  1. Stephen Kitt
    2024-01-26T13:44:19+08:002024-01-26T13:44:19+08:00

    A less heavyweight solution is to use containers. Install Docker or Podman, and follow the recipe in eyoung100’s answer to identify the distribution release you’re after, or look it up on Repology.

    Using the same Fedora 36 example, run a container:

    podman run -it fedora:36
    

    Você pode adicionar -vopções para disponibilizar diretórios em seu sistema dentro do contêiner:

    podman run -it -v ~/myproject:/myproject:z fedora:36
    

    (adicione apenas :zse estiver usando SELinux).

    No contêiner, instale gcce quaisquer outras ferramentas necessárias, construa seu projeto (em /myproject) e você encontrará seus arquivos no diretório que você compartilhou.

    • 2
  2. Best Answer
    eyoung100
    2024-01-26T06:57:07+08:002024-01-26T06:57:07+08:00

    My Solution

    First off, I guess I would be considered a purist in that if a package isn't in your repository, or can't be added from a third party repository, you shouldn't attempt to compile it from scratch or "force it to work" because doing so short-circuits your package manager. With that in mind, I present a rock-solid solution


    Virtualization Is Our Friend

    We need some tools and a bit of Hard Drive Space for this approach. I'll leave making space available to you but aside from that follow these steps:

    1. Install VirtualBox with your package manager
    2. Install Vagrant with your package manager

    Note: Vagrant will work with Hyper-V and docker out of the box I believe (see Stephen Kitt's answer for help with docker), but I chose VirtualBox because that's what I learned first, and if needed I can install a Desktop in the VM to configure the VM further.

    With our Virtualization Helpers installed we can continue. I'm continuing by:

    1. Gathering Requirements - I came up as a web programmer, so let's gather requirements from our customer. For our purposes, I'm going to fill in $Z now. Using Example question 2 from the Issue heading above we have the following values:
      • $X = Fedora
      • $Y = 13.2.1-6.fc39
      • $Z = 12.x.x
    2. Always use the following sentence as the Search term in your favorite engine: Which release of $X contained GCC $Z

    So using our example: Which release of Fedora contained GCC 12. Now Quoting Google:

    Update the Fedora 36 GNU Toolchain to gcc 12 and glibc 2.35. The gcc 12 is currently under development and will be included in Fedora 36 upon release. Feb 16, 2022

    1. Let's check to see if the above release - 36 - is still supported. In our search engine:
      $X release history

    Which would equate to Fedora release history in our example, which gives us Fedora Linux release history. Well, what do we do now? It looks like Fedora 36 is no longer supported. We added Vagrant for this very reason. If we visit The Vagrant Cloud, we can search for Fedora 36, which yields these results, and using a Vagrantfile, we can customize a full VM version and develop our application or website using the VM while saving our project files on our host system.

    Reason Why I Chose This Approach

    Using virtualization separates your development environment from the system you use day-to-day, and keeps you from making an irreparable mistake. I realize it will cost a bit of extra setup time, but Vagrant only needs to be installed once. A vagrantfile only needs to be created each time your project requirements change. The small learning curve for Vagrant and the Virtualization is worth the tradeoff of reinstalling an OS if a mistake is made trying to figure out how to install multiple compilers.

    • 1

relate perguntas

  • Como instalar uma versão específica do GCC no Kali Linux?

  • É possível construir uma distribuição Linux com suporte para pacotes RPM e .deb?

  • dh_usrlocal: ... não é um diretório

  • Entendendo a saída da lista apt

  • Instale o pacote ncdf4 R com shell script

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve