Project

General

Profile

Preparing a Linux machine for Bilder » History » Version 29

Jonathan Smith, 02/01/2018 04:18 AM

1 1 Redmine Admin
# Preparing a Linux machine for Bilder
2
3 15 John Cary
__If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only
4 1 Redmine Admin
5 15 John Cary
* CMake (probably present)
6
* Python (probably present)
7 16 Ted Sume
* Python-dev or Python-devel (on Fedora)
8 15 John Cary
* Latex as installed below
9 1 Redmine Admin
10 15 John Cary
and then you can add the arguments,  -W python,cmake, and your installed Python and CMake will be used if your path is correct.
11
12
## Java
13
14
At least one package (Babel) needs Oracle's java, so we recommend installing it.
15
16 1 Redmine Admin
## GCC
17 15 John Cary
18 29 Jonathan Smith
It is often useful to get a newer gcc that has mmintrinsics, although this may break compatibility with all but very recent versions of [[ CUDAgccCompatibility | CUDA ]].
19 1 Redmine Admin
20 25 John Cary
Below are the instructions for building gcc-6.4.0.
21 1 Redmine Admin
22
### Make sure 32bit glibc-devel is installed
23
24
~~~~~~
25
yum -y install glibc-devel.i686
26 22 John Cary
dnf -y install glibc-devel.i686
27 1 Redmine Admin
zypper install glibc-devel-32bit  (SLES 11 SP3)
28
~~~~~~
29
30 28 John Cary
### Get and unpack the source package
31 1 Redmine Admin
32
~~~~~~
33 25 John Cary
export GCCVER=6.4.0
34 1 Redmine Admin
wget ftp://ftp.gnu.org/gnu/gcc/gcc-${GCCVER}/gcc-${GCCVER}.tar.xz
35 28 John Cary
tar xf gcc-${GCCVER}.tar.bz2 && cd gcc-${GCCVER}
36 1 Redmine Admin
~~~~~~
37
38 28 John Cary
### Patch as needed
39
40
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
41
42
~~~~~~
43
for i in libgcc/config/*/linux-unwind.h; do
44
  if grep -q "struct ucontext" $i; then
45
    sed -i.bak 's/struct ucontext/ucontext_t/' $i
46
  fi
47
done
48
~~~~~~
49
50 1 Redmine Admin
### Build
51
52
Define CONTRIB_DIR to be your tarball installation directory, e.g.,
53
54
~~~~~~
55
export CONTRIB_DIR=/contrib
56
~~~~~~
57
58
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:
59
60
~~~~~~
61
mkdir /internal /contrib /volatile
62
chmod 775 /internal /contrib /volatile
63
~~~~~~
64
65
Unpack gcc, go into the gcc source directory, and build according to the instructions below.
66
67
**gcc:**
68
69 22 John Cary
~~~~~~
70 1 Redmine Admin
./contrib/download_prerequisites
71
mkdir build && cd build
72 25 John Cary
../configure --prefix=$CONTRIB_DIR/gcc-${GCCVER} --enable-languages=c,c++,fortran --with-pic
73 1 Redmine Admin
env LD_RUN_PATH=$CONTRIB_DIR/gcc-${GCCVER}/lib64 make -j 4
74
make install
75
# Alias as desired.
76
mkdir -p $CONTRIB_DIR/bin && cd $CONTRIB_DIR/bin
77
ln -s $CONTRIB_DIR/gcc-${GCCVER}/bin/{c,g}* .
78
~~~~~~
79
80
### Fix permissions
81
82
~~~~~~
83
chmod -R g+rwX $CONTRIB_DIR/gcc-${GCCVER}
84
chmod -R o+rX $CONTRIB_DIR/gcc-${GCCVER}
85
find $CONTRIB_DIR/gcc-${GCCVER} -type d -exec chmod g+rs '{}' \;
86
~~~~~~
87
88
89
## Java
90
91
Install Oracle's Java.
92
93
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:
94
95
~~~~~~
96
for i in java jar javac; do
97
  alternatives --install /usr/bin/$i j$i /usr/java/jdk1.6.0_16/bin/$i 3
98
done
99
alternatives --config java # Pick 3
100
~~~~~~
101
102
On SLES , Install using the tar package from Oracle, then change into the installation directory
103
104
~~~~~~
105
for i in java jar javac; do
106
  /usr/sbin/update-alternatives --install /usr/bin/$i $i <installation directory>/bin/$i 3
107
done
108
~~~~~~
109
110
where <installation directory\> is the absolute path to where Java was just installed  
111
112
## Version control systems
113
114
Make sure git, mercurial, and subversion are all installed.
115
116
## LaTeX
117
118
Install the texlive-latex package. You may need to install other packages over time. For gui usage, see texworks: http://www.tug.org/texworks
119
120
If you cannot install in the system area, you can download
121
122
~~~~~~
123
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
124
tar xzf install-tl-unx.tar.gz
125
cd install-tl-20150411 (date might be different)
126
./install-tl -no-gui
127
~~~~~~
128
129
This is now interactive, so set
130 11 Matt Copper
 
131 10 Matt Copper
* Set scheme to basic
132
** To do this type 'S' and hit enter.
133
** Then enter 'd' to set the scheme to basic.
134
** Type 'R' and hit enter to return to the main configuration page.
135 1 Redmine Admin
136 10 Matt Copper
* Set TEXDIR = $CONTRIB_DIR/texlive
137
** Start by typing 'D' and hit enter.
138
** Then enter '1' to change TEXDIR.
139
** Type $CONTRIB_DIR/texlive and hit return.
140
** To return to configuration type 'R' and return.
141 1 Redmine Admin
142 10 Matt Copper
* Set page size to Letter size
143
** Type 'O' and hit enter.
144
** Enter 'P'
145
** Return to main menu by typing 'R' and enter. 
146
147
* Install
148
** Type 'I' and hit enter to install.
149
150
* Put your texlive in your PATH.
151
** Edit you bashrc (vim ~/.bashrc)
152
** Add "export PATH=$PATH:<$CONTRIB_DIR>/texlive/bin/x86_64-linux/" (enter the full CONTRIB_DIR value)
153
** Exit and save. Then source ~/.bashrc.
154
155
To ensure you are using the correct texlive installation type "which pdflatex" and make sure it 
156
the one in $CONTRIB_DIR/texlive/bin/x86_64-linux/. If it is not the correct pdflatex, you may
157
have to remove the system version (sudo yum remove texlive). 
158 1 Redmine Admin
159
and then
160
161
~~~~~~
162 12 John Cary
    for i in breakurl capt-of cmap comment courier ec eepic environ epstopdf eqparbox \
163 21 John Cary
fancybox fancyvrb framed footnote framed fricychap gensymb helvetic latexmk lineno mdwtools mmap \
164 12 John Cary
mptopdf multirow newfloat overpic palatino parskip pdftex pifont revtex4 siunitx subfiles \
165
symbol tabulary threeparttable titlesec trimspaces txfonts units upquote url wrapfig \
166
xcite xcolor xypic zapfding; do
167 1 Redmine Admin
     tlmgr install $i
168
    done
169
~~~~~~
170
171
You may also want to install some of the fonts, avantgar bookman charter cmextra courier euro-ce eurosym marvosym mathpazo ncntrsbk pxfonts rsfs symbol times txfonts utopia wasy zapfchan zapfding.
172
173 25 John Cary
## Additional packages
174 1 Redmine Admin
175 25 John Cary
Other parts of the toolchain introduce other package requirements.  Below are the initial lists.
176
177 24 John Cary
### Fedora
178
179 1 Redmine Admin
The following packages are needed for Fedora
180
181
~~~~~~
182 19 John Cary
  bison
183
  glib2-devel
184
  libxml2-devel
185
  openssl-devel
186
  zlib-devel
187
  patch
188 1 Redmine Admin
~~~~~~
189
190 9 David Alexander
You may also need
191
192 1 Redmine Admin
~~~~~~
193 19 John Cary
  libblas-devel
194
  lapack-devel
195 9 David Alexander
~~~~~~
196
197
For more recent versions of Fedora, you will need.
198 18 John Cary
199
~~~~~~
200 19 John Cary
  egl-wayland
201
  mesa-libEGL-devel
202 18 John Cary
  redhat-rpm-config
203 1 Redmine Admin
~~~~~~
204 18 John Cary
205 24 John Cary
### Ubuntu
206 1 Redmine Admin
207
The following packages are needed for Ubuntu
208
209
~~~~~~
210
   ace-netsvcs
211
   bison
212
   flex
213
   gfortran
214
   graphviz
215
   graphviz-dev
216
   heirloom-mailx
217
   libblas-dev
218
   libfreetype6-dev
219
   libgl1-mesa-dev
220
   libglu1-mesa-dev
221
   liblapack-dev
222
   libntlm0
223
   libpng12-dev
224
   libxext-dev
225
   libxrender-dev
226
   libxtst-dev
227
   libzzip-dev
228
   mailutils
229
   python2.6
230
   python2.6-dev
231 14 Jonathan Smith
   zlib-dev *
232 1 Redmine Admin
~~~~~~
233 14 Jonathan Smith
* You will probably want a lightweight command line editor other than gedit, so "sudo apt-get install vim"  or "sudo apt-get install emacs" 
234
* zlib-dev doesn't exist on ubuntu 16.04 - use zlib1g-dev instead.
235
236
mailutils is necessary for configuring the system for jenkins. 
237
You'll be offered to choose:
238
* Internet site
239
* Internet with smarthost
240
* Satellite system
241
* Local only
242
243
Internet with smarthost is recommended.
244
245 1 Redmine Admin
246
The use of the following commands are helpful. To search for an available package dealing with a keyword, use:
247
248
~~~~~~
249
    $ sudo apt-cache search keyword
250
~~~~~~
251
252
To install a particular package, use:
253
254
~~~~~~
255
    $ sudo apt-get install libblah-dev
256
~~~~~~
257
258
Note: that development packages names typically end with "dev" not "devel" as in other flavors of linux.
259
260 24 John Cary
### Suse Linux Enterprise Server (SLES)
261 1 Redmine Admin
262
The following packages are needed on SLES
263
264
~~~~~~
265
   bison
266
   blas-devel
267
   blas-devel-static
268
   libblas3
269
   flex
270
   freetype2-devel
271
   gcc
272
   gcc-32bit
273
   gcc-fortran
274
   git
275
   glibc-devel
276
   glibc-devel-32bit
277
   graphviz
278
   graphviz-devel
279
   gstreamer-0_10-devel
280
   gstreamer-0_10-plugins-base-devel
281 13 David Alexander
   libbz2-devel
282 1 Redmine Admin
   lapack-devel
283
   lapack-devel-static
284
   liblapack3
285
   libapr-util1 (needed to build subversion)
286
   libapr1      (needed to build subversion)
287
   libneon27    (needed to build subversion)
288
   libpng-devel
289
   libssh-devel
290
   libxml2-devel
291
   mailx
292
   mercurial
293
   Mesa-devel
294
   python-devel
295
   xorg-x11-devel
296
   xorg-x11-libXext-devel
297
   xorg-x11-libXrender-devel
298
   xorg-x11-libs
299
   zlib-devel
300
~~~~~~
301
302
To get blas-devel, blas-devel-static and lapack-devel, lapack-devel-static on SLES 11 SP3 , add the Science repository
303
304
~~~~~~
305
   zypper addrepo http://download.opensuse.org/repositories/science/SLE_11_SP3/science.repo
306
   zypper refresh
307
   zypper install blas-devel blas-devel-static lapack-devel lapack-devel-static
308
~~~~~~
309 24 John Cary
310 1 Redmine Admin
## Qt Prerequisites
311
312 25 John Cary
Qt-5 must be built with QtWebEngine, which particularly introduces requirements for other packages as noted at
313 24 John Cary
314 25 John Cary
* https://doc.qt.io/qt-5.10/qtwebengine-platform-notes.html
315
* https://wiki.qt.io/QtWebEngine/How_to_Try
316
* https://www.ics.com/blog/building-qtwebengine
317
* http://www.linuxfromscratch.org/blfs/view/svn/x/qtwebengine.html
318 24 John Cary
319 25 John Cary
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.
320
321 24 John Cary
### Fedora
322
323
~~~~~~
324 27 John Cary
sudo yum install alsa-lib-devel cups-devel bison flex gperf
325
sudo yum install libcap-devel libgcrypt-devel libgcrypt libgudev1-devel libsndfile-devel libwebp-devel
326
sudo yum install libXcomposite-devel libXcursor-devel libXi-devel libXrandr-devel libxslt-devel libXtst-devel
327
sudo yum install mesa-libEGL-devel nss-devel opus-devel pciutils-devel pulseaudio-libs-devel re2c ruby systemd-devel
328 1 Redmine Admin
~~~~~~
329
330
## Vendor-specific version of graphics driver
331
332
If you are preparing a Linux machine for the VisIt Visualization package, the vendor-specific graphics driver for your graphics card should be installed.
333
334
By default, a generic graphics driver is installed.  On Fedora, the generic driver is "nouveau".
335
336
To determine if the nouveau driver is installed on your system, enter the command
337
338
~~~~~~
339
     lsmod | grep nouv
340
~~~~~~
341
342
You will need to download and install the appropriate driver from your graphics card vendor.  This generally uninstalls the nouveau drivers.
343 3 Matt Copper
344 4 Matt Copper
## NVIDIA CUDA Toolkit
345 3 Matt Copper
346
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 
347
348
~~~~~~
349
     https://developer.nvidia.com/cuda-toolkit-70
350
~~~~~~
351
352
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. 
353
354
~~~~~~
355
     cd <location of download>
356
     sudo rpm -i cuda-repo-fedora21-7-0-local-7.0-28.x86_64.rpm   #<or whatever file you downloaded> 
357
     sudo dnf install cuda
358
~~~~~~
359
360 5 Matt Copper
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:
361 3 Matt Copper
362
~~~~~~
363
     which nvcc
364
~~~~~~
365
366 20 John Cary
CUDA-8 does not work with Fedora 27.  A workaround is specified at https://xpra.org/trac/ticket/1600.
367
368 23 John Cary
Looks like CUDA-9.1 works, but with only select versions of gcc, e.g., gcc-5.4.0 according to https://github.com/tensorflow/tensorflow/issues/10220.
369
370 3 Matt Copper
The output should be /usr/local/cuda-7.0/bin/nvcc. This will allow bilder to build GPU c++ code.