Project

General

Profile

Preparing a Linux machine for Bilder » History » Version 42

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