sudo apt-get install libstdc ++


16

Quando tento instalar libstdc++usando:

sudo apt-get install libstdc++

Estou recebendo o erro abaixo no ubuntu. Você tem alguma idéia sobre isso?

The following packages have unmet dependencies:
 libstdc++-4.8-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
                     Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
                     Conflicts: libstdc++6-4.7-doc but 4.7.3-12ubuntu1 is to be installed
 libstdc++-4.9-doc : Conflicts: libstdc++-4.8-doc but 4.8.5-2ubuntu1~14.04.1 is to be installed
                     Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
                     Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
                     Conflicts: libstdc++6-4.7-doc but 4.7.3-12ubuntu1 is to be installed
 libstdc++-5-doc : Conflicts: libstdc++-4.8-doc but 4.8.5-2ubuntu1~14.04.1 is to be installed
                   Conflicts: libstdc++-4.9-doc but 4.9.3-8ubuntu2~14.04 is to be installed
                   Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
                   Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
                   Conflicts: libstdc++6-4.7-doc but 4.7.3-12ubuntu1 is to be installed
 libstdc++6-4.6-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
 libstdc++6-4.6-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
 libstdc++6-4.7-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
                      Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
 libstdc++6-4.7-doc : Conflicts: libstdc++6-4.4-doc but 4.4.7-8ubuntu1 is to be installed
                      Conflicts: libstdc++6-4.6-doc but 4.6.4-6ubuntu2 is to be installed
 libstdc++6-4.8-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
                      Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
                      Conflicts: libstdc++6-4.7-dbg but 4.7.3-12ubuntu1 is to be installed
 libstdc++6-4.8-dbg-armhf-cross : Conflicts: libstdc++6-4.7-dbg-armhf-cross but 4.7.3-11ubuntu1cross1.85 is to be installed
 libstdc++6-4.9-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
                      Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
                      Conflicts: libstdc++6-4.7-dbg but 4.7.3-12ubuntu1 is to be installed
                      Conflicts: libstdc++6-4.8-dbg but 4.8.5-2ubuntu1~14.04.1 is to be installed
 libstdc++6-5-dbg : Conflicts: libstdc++6-4.4-dbg but 4.4.7-8ubuntu1 is to be installed
                    Conflicts: libstdc++6-4.6-dbg but 4.6.4-6ubuntu2 is to be installed
                    Conflicts: libstdc++6-4.7-dbg but 4.7.3-12ubuntu1 is to be installed
                    Conflicts: libstdc++6-4.8-dbg but 4.8.5-2ubuntu1~14.04.1 is to be installed
                    Conflicts: libstdc++6-4.9-dbg but 4.9.3-8ubuntu2~14.04 is to be installed
E: Unable to correct problems, you have held broken packages.

Você adicionou recentemente ppas?
Raphael

11
Na verdade, não existe um pacote chamado libstdc++(possivelmente você está tentando instalar libstdc++6? Por causa dos ++caracteres, quando aptnão encontra uma correspondência exata, ele trata o nome do pacote como uma expressão regular ; nesse caso, ele está tentando instalar qualquer pacote cujo nome partidas libstdseguido por uma ou mais c- muitos dos quais conflito, como você pode ver.
steeldriver

@steeldriver: essa é claramente a resposta e imho deve ser uma resposta, e não um comentário (embora ajudasse a ser capaz de explicar como evitar o tratamento da string como um regex). A página de manual do aptdiz que tratará nomes de pacotes como expressões regulares se incluírem ., ?ou *sem mencionar +, para que o comportamento não seja exatamente esperado.
rici 28/01

Respostas:


12

Na verdade, não existe um pacote chamado libstdc++(possivelmente você está tentando instalar libstdc++6?)

Quando o apt não encontra uma correspondência exata com o nome de um pacote, ele trata a sequência especificada como uma expressão regular. Nesse caso, ++ele faz com que tente instalar qualquer pacote cujo nome corresponda libstdseguido por um ou mais c- muitos dos quais conflitam, como você pode ver.

Infelizmente, nunca consegui descobrir como desativar esse comportamento (nada do que tentei no passado usando caracteres de escape pareceu funcionar) - a única solução que eu sei é ter cuidado ao fornecer um nome exato do pacote em que os caracteres regex pode ser mal interpretado e para garantir que o catálogo de pacotes esteja atualizado, ou seja,

sudo apt-get update
sudo apt-get install libstdc++6

isso deve ser aceito. Em relação ao turn-off: pode-se escrever um alias ou função que envolve o nome do pacote dentro de um^PACKAGE$
phil294

11

Primeiro execute estes comandos

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install aptitude

e então tente

sudo apt-get install libstdc++6

ou tente este resultado da pesquisa e instale um pacote desejado a partir dos http://packages.ubuntu.com/search?keywords=libstdc%2B%2B


2
+1 Boa resposta, mas não está libstdc++incluída no build-essentials?
Kev Inski

7
Ah, e por que instalar aptitudese você não o usa para instalar libstdc++6?
Kev Inski

2
Obrigado pela sua resposta Kev. Tentei dar algum tipo de possibilidade para o caso de não ter sucesso. E aptidão para lidar com seu erro.
MAK Ripon

sudo apt-get update apt-get: erro ao carregar bibliotecas compartilhadas: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: cabeçalho ELF inválido
mvladk

3
LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9

6
Você poderia explicar por que o usuário deve fazer isso e o que cada comando faz? (apenas no caso de alguém lê a sua resposta e decide basta copiar-colá-lo para o problema errado?) ;-)
Fabby
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.