Instalando o programa compilado anteriormente instalado em outra pasta

1

Eu compilei gcc e dependências ( gmp , mpfr , mpc ) na pasta específica para obter backup dessas pastas em outras, não repetir o processo de compilação e passar para outras máquinas.

MAKE apenas para atualização

$ tar zxvf make-4.2.1.tar.gz -C /usr/local/Sources/
$ cd /usr/local/Sources/make-4.2.1/
$ ./configure --prefix=/usr/local/Custom/make
$ sh ./build.sh
$ ./make check
$ sudo ./make install

Dependências para o GCC

GMP

$ tar Jxvf gmp-6.1.2.tar.xz -C /usr/local/Sources/
$ cd /usr/local/Sources/gmp-6.1.2/
$ ./configure --prefix=/usr/local/Custom/gmp --enable-cxx --disable-static
$ make
$ sudo make install

MPFR

$ tar -zxvf mpfr-3.1.6.tar.gz -C /usr/local/Sources/
$ ./configure --prefix=/usr/local/Custom/mpfr --disable-static --enable-thread-safe --with-gmp=/usr/local/Custom/gmp
$ make
$ sudo make install

MPC

$ tar -zxvf mpc-1.0.3.tar.gz -C /usr/local/Sources/
$ cd /usr/local/Sources/mpc-1.0.3/
$ ./configure --prefix=/usr/local/Custom/mpc --with-gmp=/usr/local/Custom/gmp -with-mpfr=/usr/local/Custom/mpfr
$ make
$ make check
$ sudo make install

link

GCC

$ tar zxvf gcc-7.2.0.tar.gz -C /usr/local/Sources/
$ cd /usr/local/Sources/gcc-7.2.0/
$ ./configure --prefix=/usr/local/Custom/gcc --with-system-zlib --disable-multilib --enable-lenguages=c,c++ --with-gmp=/usr/local/Custom/gmp -with-mpfr=/usr/local/Custom/mpfr --with-mpc=/usr/local/Custom/mpc
$ time make -j $(nproc)

O tempo gasto é mais de 8 horas

real    506m8.644s
user    461m46.399s
sys 30m54.429s
$ 

$ time sudo make install

O tempo gasto é

real    1m52.495s
user    0m35.449s
sys 0m35.820s
$ 

AGORA, a hierarquia é:

$ tree -d /usr/local/Custom/
/usr/local/Custom/
├── gcc
│   ├── bin
│   ├── include
│   │   └── c++
│   │       └── 7.2.0
│   │           ├── backward
│   │           ├── bits
│   │           ├── debug
│   │           ├── decimal
│   │           ├── experimental
│   │           │   └── bits
│   │           ├── ext
│   │           │   └── pb_ds
│   │           │       └── detail
│   │           │           ├── REMOVED IN ORDER TO MAKE SHORT THIS QUESTION
│   │           ├── parallel
│   │           ├── profile
│   │           │   └── impl
│   │           ├── tr1
│   │           ├── tr2
│   │           └── x86_64-pc-linux-gnu
│   │               ├── bits
│   │               └── ext
│   ├── lib
│   │   └── gcc
│   │       └── x86_64-pc-linux-gnu
│   │           └── 7.2.0
│   │               ├── REMOVED IN ORDER TO MAKE SHORT THIS QUESTION
│   ├── lib64
│   ├── libexec
│   │   └── gcc
│   │       └── x86_64-pc-linux-gnu
│   │           └── 7.2.0
│   │               ├── install-tools
│   │               └── plugin
│   └── share
│       ├── gcc-7.2.0
│       │   └── python
│       │       └── libstdcxx
│       │           └── v6
│       ├── info
│       ├── locale
│       │   ├── REMOVED IN ORDER TO MAKE SHORT THIS QUESTION
│       └── man
│           ├── man1
│           └── man7
├── gmp
│   ├── include
│   ├── lib
│   └── share
│       └── info
├── make
│   ├── bin
│   ├── include
│   └── share
│       ├── info
│       ├── locale
│       │   ├── REMOVED IN ORDER TO MAKE SHORT THIS QUESTION
│       └── man
│           └── man1
├── mpc
│   ├── include
│   ├── lib
│   └── share
│       └── info
├── mpfr
│   ├── include
│   ├── lib
│   └── share
│       ├── doc
│       │   └── mpfr
│       │       └── examples
│       └── info

Agora, nas máquinas de destino, o Original locations é:

$ whereis gmp mpfr mpc
gmp: /usr/include/gmp.h
mpfr: /usr/include/mpfr.h
mpc: /usr/include/mpc.h
$ which make gcc
/usr/local/bin/make
/usr/bin/gcc
$ 

As perguntas

Como atualizar ( make , gmp , mpfr , mpc e gcc ) as outras máquinas com essas pastas?

  • Substituindo os comandos antigos (em seu Original locations )?
  • Preservando os comandos antigos (em outra pasta como: /my/Folder/Commands )?
por Chepe Questn 06.12.2017 / 17:10

1 resposta

0

Não funciona para LD_LIBRARY_PATH

$ more /etc/environment 
PATH=/usr/local/Custom/make/bin:/usr/local/Custom/gcc/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
CPATH=/usr/local/Custom/make/include:/usr/local/Custom/gmp/include:/usr/local/Custom/mpfr/include:/usr/local/Custom/mpc/include
LD_LIBRARY_PATH=/usr/local/Custom/gmp/lib:/usr/local/Custom/mpfr/lib:/usr/local/Custom/mpc/lib
$

Tentando com root user

$ more /root/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

LD_LIBRARY_PATH=/usr/local/Custom/gmp/lib:/usr/local/Custom/mpfr/lib:/usr/local/Custom/mpc/lib
export LD_LIBRARY_PATH
$

Em ambos os casos, recebo:

$ echo $LD_LIBRARY_PATH

$

AQUI minha solução para lib !

$ more /etc/ld.so.conf.d/custom.conf
/usr/local/Custom/gmp/lib
/usr/local/Custom/mpfr/lib
/usr/local/Custom/mpc/lib

AQUI minha solução para include e bin !

$ more /etc/environment 
PATH=/usr/local/Custom/make/bin:/usr/local/Custom/gcc/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/
sbin:/bin:/sbin
CPATH=/usr/local/Custom/make/include:/usr/local/Custom/gmp/include:/usr/local/Custom/mpfr/include:/usr/local/Custom/mpc/include
$ 

Agora eu confiro:

$ which make gcc
/usr/local/Custom/make/bin/make
/usr/local/Custom/gcc/bin/gcc
$

$  cpp -v
Using built-in specs.
COLLECT_GCC=cpp
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/usr/local/Custom/gcc --with-system-zlib --disable-multilib --enable-lenguages=c,c++ --with-gmp=/usr/local/Custom/gmp -with-mpfr=/usr/local/Custom/mpfr --with-mpc=/usr/local/Custom/mpc
Thread model: posix
gcc version 7.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /usr/local/Custom/gcc/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/cc1 -E -quiet -v - -mtune=generic -march=x86-64
ignoring nonexistent directory "/usr/local/Custom/gcc/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Custom/make/include
 /usr/local/Custom/gmp/include
 /usr/local/Custom/mpfr/include
 /usr/local/Custom/mpc/include
 /usr/local/Custom/gcc/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include
 /usr/local/include
 /usr/local/Custom/gcc/include
 /usr/local/Custom/gcc/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
 /usr/include
End of search list.

Infelizmente recebo:

$ whereis gmp mpfr mpc
gmp:mpfr:mpc:[ ~]$ 
    
por 08.12.2017 / 04:40