nix:gcc
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| nix:gcc [2016/04/22 10:12] – created kauffman | nix:gcc [2021/01/20 12:25] (current) – kauffman | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== GCC ====== | ====== GCC ====== | ||
| + | |||
| + | ===== GCC Versions that are already installed on CS infrastructure ===== | ||
| + | Usually, we install multiple versions. The default version of GCC probably won't be changed system wide... ever. | ||
| + | |||
| + | We are now taking more advantage of environment modules. This means depending on when you read this you could load the version of GCC you want to use. | ||
| + | |||
| + | < | ||
| + | $ module --terse avail |grep gcc | ||
| + | / | ||
| + | gcc/4.9.4 | ||
| + | gcc/5.5.0 | ||
| + | gcc/6.5.0 | ||
| + | gcc/7.5.0 | ||
| + | gcc/8.4.0 | ||
| + | gcc/9.3.0 | ||
| + | gcc/10.2.0 | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ module load gcc/4.9.4 | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ echo "$PATH | $INCLUDE | $LD_LIBRARY_PATH | $MANPATH" | ||
| + | / | ||
| + | | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ gcc --version | ||
| + | gcc (GCC) 4.9.4 | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ module unload gcc | ||
| + | </ | ||
| + | |||
| + | |||
| ===== Building GCC in your home directory ===== | ===== Building GCC in your home directory ===== | ||
| - | Strap in cause this will take a while. You will want to prepare a sandwich and a drink once we start compiling. | + | https://gcc.gnu.org/ |
| + | |||
| + | You will want to prepare a sandwich and a drink once we start compiling. | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | - About 6.5G of scratch space. | ||
| + | - ~1G for the actual install. This means if you require a higher [[ techstaff: | ||
| + | You will want to use /var/tmp, /tmp, or /local as the place to checkout and build GCC. | ||
| ==== Example ==== | ==== Example ==== | ||
| Line 8: | Line 54: | ||
| #!/bin/bash | #!/bin/bash | ||
| - | PREFIX=$HOME/ | + | gccversion=' |
| + | PREFIX="$HOME/.local/gcc/${gccversion}" | ||
| - | # Building gcc in $HOME | + | # Building gcc |
| + | gccversionuc=" | ||
| INSTALLDIR=/ | INSTALLDIR=/ | ||
| Line 16: | Line 64: | ||
| cd $INSTALLDIR | cd $INSTALLDIR | ||
| - | svn co svn:// | + | svn co svn:// |
| - | cd gcc-4.9.3 | + | cd gcc-${gccversion} |
| ./ | ./ | ||
| cd ../ | cd ../ | ||
| mkdir objdir | mkdir objdir | ||
| cd objdir | cd objdir | ||
| - | $PWD/ | + | $PWD/ |
| --prefix=$PREFIX \ | --prefix=$PREFIX \ | ||
| --enable-languages=c, | --enable-languages=c, | ||
| Line 31: | Line 79: | ||
| make install | make install | ||
| - | export PATH=$PREFIX/ | + | # clean up |
| - | export LD_LIBRARY_PATH=$PREFIX/ | + | rm -r $INSTALLDIR/ |
| + | |||
| + | export PATH=$HOME/$PREFIX/ | ||
| + | export LD_LIBRARY_PATH=$HOME/$PREFIX/ | ||
| echo "You should add the following to your .bashrc" | echo "You should add the following to your .bashrc" | ||
| echo "to make the exports permanent" | echo "to make the exports permanent" | ||
| - | echo " | + | echo " |
| - | echo " | + | echo " |
| + | </ | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | ==== ' | ||
| + | To resolve you may have to do the following: | ||
| + | < | ||
| + | source / | ||
| </ | </ | ||
/var/lib/dokuwiki/data/attic/nix/gcc.1461337922.txt.gz · Last modified: 2016/04/22 10:12 by kauffman