Project

General

Profile

Preparing a Linux machine for Bilder » History » Revision 45

Revision 44 (John Cary, 03/03/2018 07:57 AM) → Revision 45/86 (John Cary, 03/03/2018 08:11 AM)

# Preparing a Linux machine for Bilder 

 __If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only 

 * CMake (probably present) 
 * Python (probably present) 
 * Python-dev or Python-devel (on Fedora) 
 * Latex as installed below 

 and then you can add the arguments,    -W python,cmake, and your installed Python and CMake will be used if your path is correct. 

 ## Java 

 At least one package (Babel) needs Oracle's java, so we recommend installing it. 

 ## GCC 

 It is often useful to get a newer gcc that has mmintrinsics. This may break compatibility with some versions of [[ CUDAgccCompatibility | CUDA ]]. 

 Below are the instructions for building gcc-6.4.0. [[ BilderKnownIssuesGcc730 | (As of this writing 6.4 is the latest compiler to work with CUDA-9.1, and gcc-5.3.1 will not build QT-5.10.0) ]] 

 ### Make sure 32bit glibc-devel is installed 

 Do the applicable of 

 ~~~~~~ 
 yum -y install glibc-devel.i686 
 dnf -y install glibc-devel.i686 
 zypper install glibc-devel-32bit    (SLES 11 SP3) 
 ~~~~~~ 

 ### Get and unpack the source package 

 ~~~~~~ 
 export GCCVER=6.4.0 
 wget ftp://ftp.gnu.org/gnu/gcc/gcc-${GCCVER}/gcc-${GCCVER}.tar.xz 
 tar xf gcc-${GCCVER}.tar.xz && cd gcc-${GCCVER} 
 ~~~~~~ 

 ### Patch as needed 

 If your system has glibc 2.26 or later, you will need to fix the source by making the changes specified in    https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=72edc2c02f8b4768ad660f46a1c7e2400c0a8e06 and also 

 ~~~~~~ 
 for i in libgcc/config/*/linux-unwind.h; do 
   if grep -q "struct ucontext" $i; then 
     sed -i.bak 's/struct ucontext/ucontext_t/' $i 
   fi 
 done 
 ~~~~~~ 

 ### Build 

 Define CONTRIB_DIR to be your tarball installation directory, e.g., 

 ~~~~~~ 
 export CONTRIB_DIR=/contrib 
 ~~~~~~ 

 Usually CONTRIB_DIR=/contrib, but if one does not have root access, one has to put this in a user area. If one does have root access, one should execute the following commands: 

 ~~~~~~ 
 mkdir /internal /contrib /volatile 
 chmod 775 /internal /contrib /volatile 
 ~~~~~~ 

 Unpack gcc, go into the gcc source directory, and build according to the instructions below. 

 **gcc:** 

 ~~~~~~ 
 ./contrib/download_prerequisites 
 mkdir build && cd build 
 ../configure --prefix=$CONTRIB_DIR/gcc-${GCCVER} --enable-languages=c,c++,fortran --with-pic 
 env LD_RUN_PATH=$CONTRIB_DIR/gcc-${GCCVER}/lib64 make -j 4 
 make install 
 # Alias as desired. 
 mkdir -p $CONTRIB_DIR/bin && cd $CONTRIB_DIR/bin 
 ln -s $CONTRIB_DIR/gcc-${GCCVER}/bin/{c,g}* . 
 ~~~~~~ 

 ### Fix permissions 

 ~~~~~~ 
 chmod -R g+rwX $CONTRIB_DIR/gcc-${GCCVER} 
 chmod -R o+rX $CONTRIB_DIR/gcc-${GCCVER} 
 find $CONTRIB_DIR/gcc-${GCCVER} -type d -exec chmod g+rs '{}' \; 
 ~~~~~~ 

 ## Java 

 Install Oracle's Java. 

 Once it is installed, you will need to modify your path to include /usr/java/default/bin before /usr/bin or use the alternatives package: 

 ~~~~~~ 
 for i in java jar javac; do 
   alternatives --install /usr/bin/$i j$i /usr/java/jdk1.6.0_16/bin/$i 3 
 done 
 alternatives --config java # Pick 3 
 ~~~~~~ 

 On SLES , Install using the tar package from Oracle, then change into the installation directory 

 ~~~~~~ 
 for i in java jar javac; do 
   /usr/sbin/update-alternatives --install /usr/bin/$i $i <installation directory>/bin/$i 3 
 done 
 ~~~~~~ 

 where <installation directory\> is the absolute path to where Java was just installed   

 ## Version control systems 

 Make sure git, mercurial, and subversion are all installed. 

 ## LaTeX 

 Install the texlive-latex package. You may need to install other packages over time. For gui usage, see texworks: http://www.tug.org/texworks 

 If you cannot install in the system area, you can download 

 ~~~~~~ 
 wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz 
 tar xzf install-tl-unx.tar.gz 
 cd install-tl-20150411 (date might be different) 
 ./install-tl -no-gui 
 ~~~~~~ 

 This is now interactive, so set 
 
 * Set scheme to basic 
 ** To do this type 'S' and hit enter. 
 ** Then enter 'd' to set the scheme to basic. 
 ** Type 'R' and hit enter to return to the main configuration page. 

 * Set TEXDIR = $CONTRIB_DIR/texlive 
 ** Start by typing 'D' and hit enter. 
 ** Then enter '1' to change TEXDIR. 
 ** Type $CONTRIB_DIR/texlive and hit return. 
 ** To return to configuration type 'R' and return. 

 * Set page size to Letter size 
 ** Type 'O' and hit enter. 
 ** Enter 'P' 
 ** Return to main menu by typing 'R' and enter.  

 * Install 
 ** Type 'I' and hit enter to install. 

 * Put your texlive in your PATH. 
 ** Edit you bashrc (vim ~/.bashrc) 
 ** Add "export PATH=$PATH:<$CONTRIB_DIR>/texlive/bin/x86_64-linux/" (enter the full CONTRIB_DIR value) 
 ** Exit and save. Then source ~/.bashrc. 

 To ensure you are using the correct texlive installation type "which pdflatex" and make sure it  
 the one in $CONTRIB_DIR/texlive/bin/x86_64-linux/. If it is not the correct pdflatex, you may 
 have to remove the system version (sudo yum remove texlive).  

 and then 

 ~~~~~~ 
 tlmgr install breakurl capt-of cmap comment courier ec eepic environ epstopdf eqparbox \ 
 fancybox fancyvrb fncychap framed footnote fricychap gensymb helvetic latexmk lineno mdwtools mmap \ 
 mptopdf multirow needspace newfloat overpic palatino parskip pdftex pifont revtex4 siunitx subfiles \ 
 symbol tabulary threeparttable titlesec trimspaces txfonts units upquote ur    varwidth wrapfig \ 
 xcite xcolor xypic zapfding 
 ~~~~~~ 

 You may also want to install some of the fonts,  
 ~~~~~~ 
 tlmgr install    avantgar bookman charter cmextra courier euro-ce eurosym marvosym mathpazo \ 
 ncntrsbk pxfonts rsfs symbol times txfonts utopia wasy zapfchan zapfding 
 ~~~~~~ 

 ## Additional packages 

 Other parts of the toolchain introduce other package requirements.    Below are the initial lists. 

 ### Fedora 

 The following packages (cut and paste after dnf install or yum install) are needed for Fedora, Redhat, CentOS 

 ~~~~~~ 
 bc bison glib2-devel imake lapack-devel libblas-devel libcurl-devel libxml2-devel openssl-devel patch redhat-lsb zlib-devel 
 ~~~~~~ 

 For more recent versions of Fedora, you will need. 

 ~~~~~~ 
 egl-wayland mesa-libEGL-devel redhat-rpm-config 
 ~~~~~~ 

 ### Ubuntu 

 The following packages are needed for Ubuntu 

 ~~~~~~ 
    ace-netsvcs 
    bc 
 bison 
    flex 
    gfortran 
    graphviz 
    graphviz-dev 
    heirloom-mailx 
    libblas-dev 
    libfreetype6-dev 
    libgl1-mesa-dev 
    libglu1-mesa-dev 
    liblapack-dev 
    libntlm0 
    libpng12-dev 
    libxext-dev 
    libxrender-dev 
    libxtst-dev 
    libzzip-dev 
    mailutils 
    python2.6 
    python2.6-dev 
    zlib-dev * 
 ~~~~~~ 
 * You will probably want a lightweight command line editor other than gedit, so "sudo apt-get install vim"    or "sudo apt-get install emacs"  
 * zlib-dev doesn't exist on ubuntu 16.04 - use zlib1g-dev instead. 

 mailutils is necessary for configuring the system for jenkins.  
 You'll be offered to choose: 
 * Internet site 
 * Internet with smarthost 
 * Satellite system 
 * Local only 

 Internet with smarthost is recommended. 


 The use of the following commands are helpful. To search for an available package dealing with a keyword, use: 

 ~~~~~~ 
 $ sudo apt-cache search keyword 
 ~~~~~~ 

 To install a particular package, use: 

 ~~~~~~ 
 $ sudo apt-get install libblah-dev 
 ~~~~~~ 

 Note: that development packages names typically end with "dev" not "devel" as in other flavors of linux. 

 ### Suse Linux Enterprise Server (SLES) 

 The following packages (in cut/paste for zypper form) are needed on SLES 

 ~~~~~~ 
 bc bison blas-devel blas-devel-static libblas3 flex freetype2-devel 
 gcc gcc-32bit gcc-fortran git glibc-devel glibc-devel-32bit 
 graphviz graphviz-devel libbz2-devel lapack-devel lapack-devel-static liblapack3 libpng-devel libssh-devel libxml2-devel 
 mailx mercurial Mesa-devel python-devel 
 xorg-x11-devel xorg-x11-libXext-devel xorg-x11-libXrender-devel xorg-x11-libs zlib-devel 
 ~~~~~~ 

 The following are needed to build subversion 

 ~~~~~~ 
 libapr-util1 libapr1 libneon27 
 ~~~~~~ 


 To get blas-devel, blas-devel-static and lapack-devel, lapack-devel-static on SLES 11 SP3 , add the Science repository 

 ~~~~~~ 
 zypper addrepo http://download.opensuse.org/repositories/science/SLE_11_SP3/science.repo 
 zypper refresh 
 zypper install blas-devel blas-devel-static lapack-devel lapack-devel-static 
 ~~~~~~ 

 ## Qt Prerequisites 

 Qt-5 must be built with QtWebEngine, which particularly introduces requirements for other packages as noted at 

 * https://doc.qt.io/qt-5.10/qtwebengine-platform-notes.html 
 * https://wiki.qt.io/QtWebEngine/How_to_Try 
 * https://www.ics.com/blog/building-qtwebengine 
 * http://www.linuxfromscratch.org/blfs/view/svn/x/qtwebengine.html 

 Each of the above websites appears to have made assumptions about what is already installed, so as one encounters more workstations, one is likely to find yet another package missing.    This is our list so far. 

 ### Fedora 

 ~~~~~~ 
 sudo yum install alsa-lib-devel bison cups-devel dbus-devel flex fontconfig-devel gperf libicu-devel 
 sudo yum install libcap-devel libgcrypt-devel libgcrypt libgudev1-devel libsndfile-devel libwebp-devel 
 sudo yum install libXcomposite-devel libXcursor-devel libXi-devel libXrandr-devel libxslt-devel libXtst-devel 
 sudo yum install mesa-libEGL-devel nss-devel opus-devel pciutils-devel pulseaudio-libs-devel re2c ruby systemd-devel 
 ~~~~~~ 

 ## Vendor-specific version of graphics driver 

 If you are preparing a Linux machine for the VisIt Visualization package, the vendor-specific graphics driver for your graphics card should be installed. 

 By default, a generic graphics driver is installed.    On Fedora, the generic driver is "nouveau". 

 To determine if the nouveau driver is installed on your system, enter the command 

 ~~~~~~ 
 lsmod | grep nouv 
 ~~~~~~ 

 You will need to download and install the appropriate driver from your graphics card vendor.    This generally uninstalls the nouveau drivers. 

 ## NVIDIA CUDA Toolkit 

 If you have a compatible GPU and wish to compile with nvcc code, you must first install the CUDA Toolkit. The linux installation page is  

 ~~~~~~ 
 https://developer.nvidia.com/cuda-toolkit-70 
 ~~~~~~ 

 Download the applicable file. Your Linux distribution may or may not be natively supported for version 7.0. You may alternatively use version 7.5 if supported or an older version if necessary. As an example, we will include the steps known to work for Fedora 22. On Fedora 22, download the Fedora 21 Local RPM package.  

 ~~~~~~ 
 cd <location of download> 
 sudo rpm -i cuda-repo-fedora21-7-0-local-7.0-28.x86_64.rpm     #<or whatever file you downloaded>  
 sudo dnf install cuda 
 ~~~~~~ 

 Different Linux distributions will have different package handlers (here we use dnf, ubuntu has apt-get, fedora < 22 uses yum). You should now have the directory /usr/local/cuda-7.0. Add /usr/local/cuda-7.0/bin to your path. To ensure you have gotten the necessary components, type: 

 ~~~~~~ 
 which nvcc 
 ~~~~~~ 
 The output should be /usr/local/cuda-7.0/bin/nvcc. This will allow bilder to build GPU c++ code. 

 IMPORTANT NOTE: CUDA versions only support particular GCC versions, and the latest GCC may not support your CUDA.[[ CUDAgccCompatibility | See this wiki page for details ]]