Linux - faça a instalação sem substituir os links simbólicos

0

Eu recentemente (e tolamente, como há uma solução simples aqui, defini a opção --prefix= como algo diferente de seu padrão /usr/bin ) configure de make d gcc-4.9.1 , sem definir --prefix= opção. Eu realmente não quero re make a coisa toda, já que vai demorar muito tempo.

Meu diretório /usr/bin/ já contém gcc-4.8.2 , conforme instalado pelo SO (Ubuntu-14.04). O ponto chave é que os links simbólicos existentes apontam para coisas como gcc-4.8 e serão substituídos no comando make install por links simbólicos para gcc-4.9 , g++-4.9 etc.

Posso passar um argumento para make , dizendo para não substituir os links simbólicos que já existem? Ou similar?

    
por chrisb2244 02.09.2014 / 08:38

1 resposta

0

Em primeiro lugar, observe que o prefixo padrão a menos que um seja explicitamente especificado é mais frequentemente / usr / local. Portanto, sobrescrever a instalação em / usr pode nem ser um problema no seu caso, embora certamente possa causar confusão no futuro tendo um GCC em / usr e outro em / usr / local.

Embora eu não tenha certeza se ele funciona especificamente com o gcc-4.9.1 (embora eu veja poucos motivos para isso não funcionar), o autoconf (que gera o script configure ) fornece recursos para sobrescrever o prefixo em tempo de instalação.

Citando a documentação do autoconf, seção "nomes de instalação ":

The most portable way to affect installation locations is to pass the correct locations to configure; however, many packages provide one or both of the following shortcuts of passing variable assignments to the ‘make install’ command line to change installation locations without having to reconfigure or recompile.

The first method involves providing an override variable for each affected directory. For example, ‘make install prefix=/path/to/alternate’ will choose an alternate location, as well as influencing all other directory configuration variables that were expressed in terms of ‘${prefix}’ (or, put another way, all directories specified during configure but not in terms of the common prefix must each be overridden at install time for the entire installation to be relocated). The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool.

The second method involves providing the ‘DESTDIR’ variable. For example, ‘make install DESTDIR=/path/to/alternate’ will prepend ‘/path/to/alternate’ before all installation paths. The approach of ‘DESTDIR’ overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of ‘${prefix}’ at configure time. For packages which support ‘DESTDIR’, the variable should remain undefined during configure and ‘make all’, and only be specified during ‘make install’.

Portanto, make install DESTDIR=/opt/gcc-4.8.2 deve fazer praticamente o que você procura. Talvez seja necessário mover os arquivos um pouco depois, dependendo da estrutura de diretórios exata desejada, mas ela deve ser boa o suficiente para começar.

Note que eu não testei isso; você corre por seu próprio risco.

    
por 02.09.2014 / 10:36