Project

General

Profile

Preparing a Linux machine for Bilder » History » Revision 75

Revision 74 (Seth Veitzer, 07/30/2021 02:35 PM) → Revision 75/86 (John Cary, 12/04/2021 03:05 PM)

# 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 
 * Perl-dev or Perl-devel with perl-ExtUtils-Embed 

 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-8.3.0. [[ BilderKnownIssuesGcc730 | (As of this writing, 8.3 is the latest compiler to work with CUDA-10.2, 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=8.3.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 GCC_INSTS_DIR to be your tarball installation directory, e.g., 

 ~~~~~~ 
 export GCC_INSTS_DIR=/contrib 
 ~~~~~~ 

 Usually GCC_INSTS_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:** 

 You may need to set some addition options, e.g., ```ADDLOPTS=--with-cpu=power9``` on linuxppc64le. 

 ~~~~~~ 
 ./contrib/download_prerequisites 
 mkdir build && cd build 
 ../configure --prefix=$GCC_INSTS_DIR/gcc-${GCCVER} --enable-languages=c,c++,fortran --with-pic $ADDLOPTS 
 env LD_RUN_PATH=$GCC_INSTS_DIR/gcc-${GCCVER}/lib64 make -j 4 
 make install 
 chmod -R a+rX $GCC_INSTS_DIR/gcc-${GCCVER} # Perms issues seen in 9.4.0: 9.4.0/include-fixed/openssl/bn.h 
 # Alias as desired. 
 mkdir -p $GCC_INSTS_DIR/bin && cd $GCC_INSTS_DIR/bin 
 ln -s $GCC_INSTS_DIR/gcc-${GCCVER}/bin/{c,g}* . 
 ~~~~~~ 

 ### Fix permissions 

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


 ## Python 

 For Python 3 

 On Linux, libffi must be installed at the system level in order to properly get ctypes. 

 ~~~~~~ 
 sudo yum -y install libffi-devel 
 ~~~~~~ 

 Qt requires Python 2 to build webengine for Chromium, expected through release 5.16 at least. The Qt configure system (perl) looks for the executable "python2" in PATH, and if not found looks for executable "python". Thus Python 2 needs to be installed on the build system and in the PATH in order to build Composer. 

 ## 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. 

 For building VisIt, install git large file storage: https://git-lfs.github.com/ 
 Download the tarball from that site, untar, and run 

 ~~~~~~ 
 git lfs install --force --skip-smudge 
 ~~~~~~ 

 ## LaTeX 

 LaTeX is needed for building documentation using Sphinx. 

 Bilder prefers the texlive-latex package. 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 install the packages noted at 

 [[LaTeX packages needed by Bilder]] 


 ## Additional packages 

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

 ### Fedora / Redhat / CentOS 

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

 ~~~~~~ 
 bc bison git-lfs glib2-devel imake krb5-devel lapack-devel blas-devel blas-static libcurl-devel libxkbcommon-devel libxkbcommon-x11-devel libxml2-devel openssl-devel patch redhat-lsb zlib-devel libXt-devel 
 ~~~~~~ 

 For more recent versions of Fedora, you will need. 

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

 For centos7 you will also need. 

 ~~~~~~ 
 imake xorg-x11-utils 
 ~~~~~~ 

 and to build Qt 5 for VisIt you will need. 

 ~~~~~~ 
 dbus-devel nss-devel gperf libxcb-devel xcb-util-renderutil-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel xcb-util-devel xcb-util-cursor-devel 
 ~~~~~~ 


 ### Ubuntu 

 The following packages are needed for Ubuntu 

 ~~~~~~ 
 ace-netsvcs 
 bc 
 bison 
 flex 
 gfortran 
 graphviz 
 libblas-dev 
 libfreetype6-dev 
 libgl1-mesa-dev 
 libglu1-mesa-dev 
 libgraphviz-dev 
 liblapack-dev 
 libntlm0 
 libpng-dev 
 libxext-dev 
 libxrender-dev 
 libxtst-dev 
 libzzip-dev 
 mailutils 
 python2.7 
 python2.7-dev 
 zlib1g-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 libstdc++-static 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 ]]