forked from PMunkes/LHAPDF
-
Notifications
You must be signed in to change notification settings - Fork 1
/
INSTALL
205 lines (149 loc) · 8.73 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/**
@page install Installation instructions
@tableofcontents
@section downloads Source file downloads
The source files can be downloaded from https://www.hepforge.org/downloads/lhapdf
@section quickstart Quick start instructions
If you have a C++ compiler and the Boost C++ library+headers installed in system
paths, building LHAPDF should be straightforward:
wget http://www.hepforge.org/archive/lhapdf/LHAPDF-6.X.Y.tar.gz
tar xf LHAPDF-6.X.Y.tar.gz
cd LHAPDF-6.X.Y
./configure --prefix=/path/for/installation
make
make install
You will then need to install PDF data files, most easily using the "lhapdf"
manager script but also possible by manual download. See the LHAPDF website for
details.
On systems where you want to use non-system compilers and libraries, the
configure command will need to be a bit more complicated: see the following for
more information.
@section compilers Build tools
LHAPDF6 just needs your system to have a copy of Make and a C++ compiler: there
is no Fortran code and hence no need for gfortran. We have tested with both the
g++ and clang++ compilers and LHAPDF6 compiles with all known versions.
Building LHAPDF is typically straightforward on Linux systems, including SLC6
and Ubuntu. Mac OS X, however, can cause problems due to inconsistent compiler
and Python versions, and other such fun. If you want to build LHAPDF on a Mac,
please see @ref osx.
@section externals External dependencies
@subsection boost Boost
LHAPDF6 makes use of header files from the Boost C++ utility library
(http://www.boost.org). On Linux machines this should typically be available via
your system's packaging mechanism, e.g. the `libboost-all-dev` package on Ubuntu
and other Debian derivatives. On Scientific Linux 6 the system installation of
Boost is sufficient for LHAPDF 6.0.5 and later. By comparison, the system copy
on SL5 is too old, but surely everyone has upgraded to v6 by now...
Building Boost by hand is not particularly simple and should not be needed in
most cases: we recommend avoiding this! If you have access to the CERN AFS
filesystem, you can find builds of Boost for various platforms in the
`/afs/cern.ch/sw/lcg/external/Boost/` directory. If you really want or need to
do it manually, version 6.0.5 and later of LHAPDF only use Boost headers
(previous ones used compiled libraries) and rather than fully building Boost,
you can just use the header files direct from its source tarball: this is not
wonderfully neat, but is a lot easier than doing a full manual build and
installation of the Boost libraries.
@subsection pyext Python
If you want to build the Python interface to LHAPDF (which is very nice!), you
will need the Python development headers to be installed (e.g. via the
`python-dev` Ubuntu package). If the `Python.h` header is not found by
`configure`, no Python extension module will be built.
<!--
@subsection cmake CMake (old versions only)
@note In version 6.0.5, the CMake system (i.e. `cmake` command) must also be
installed, in order to build an internal copy of the yaml-cpp parser library
(http://code.google.com/p/yaml-cpp/) used to read the PDF metadata which is in
YAML format (http://www.yaml.org). Before this you needed to install an external
version of yaml-cpp. Both these requirements were removed in version 6.1.0,
where a special version of yaml-cpp is built internally without needing CMake at
all: you should upgrade to the v6.1 releases to make life easy!
-->
@section lhapdf Building LHAPDF
If you have downloaded a release tarball for LHAPDF 6.X.Y, unpack it with `tar
xf LHAPDF-6.X.Y.tar.gz`, then `cd` to the newly-created directory.
@note If checking out from version control rather than unpacking a tarball,
again `cd` to the new directory, but you must then also run `autoreconf -i`
before proceeding to the instructions below. There will also be more
requirements for external packages if you build this way, since this is the
"developer" route to building LHAPDF and requires a bit more expertise.
Now you should run the `configure` script to analyse your machine, compiler,
etc. and set up the Makefiles. You will probably need to provide the `--prefix`
argument to `configure` to tell it where you want to install LHAPDF (probably
you don't want to install to `/usr/local`, which is the default) and perhaps use
the `--with-boost` flag to indicate the locations of your
Boost installation. For example,
./configure --prefix=$HOME/local
should be appropriate if you have installed Boost in `/usr` via your
machine's packaging system. If not, you will need something like
./configure --prefix=$HOME/local --with-boost=$HOME/pkgs/boost-1_58
The `--prefix`, `--with-boost`, etc. path flags expect the "base" location of
the package, e.g. if you have installed library X such that there are headers in
`/foo/include/` (or `/foo/include/X`) and a compiled library (or libraries) in
`/foo/lib/` then you would use `--with-X=/foo`.
An example build script for LHAPDF6 on the CERN lxplus6 system is shown at the
end of these instructions.
@subsection altcomp Alternative compilers
If you want to use an alternative C++ compiler, then you can specify the CXX
variable on the command line. This is essential on OS X Mavericks and later,
where the consistent compiler suite is clang rather than gcc -- in that
situation, use:
./configure --prefix=... CC=clang CXX=clang++
The configure script will run and produce quite a bit of output from its various
tests. Hopefully everything will be successful: if it gets to the end without
stopping due to an error then all is well.
Then just call `make` to build the library (or e.g. `make -j4` to compile 4
files in parallel -- if your machine has enough processor cores to do so, even
`-j2` will speed up the build quite a bit). To install LHAPDF to the `--prefix`
location that you specified, call `make install`. You will (or at least
*should(!) find installed files in `$prefix/lib`, `$prefix/include/LHAPDF`, and
`$prefix/share/LHAPDF`.
@section lxplus Building on lxplus
CERN's lxplus shared system is always an awkward environment to build packages,
since the system compiler etc. are not part of the LCG supported list of
architectures. Here is an example of how to build LHAPDF and its dependencies
there -- although you can of course use other compilers, Python versions, build
flags, etc. as you wish!
## Set up LCG build tools (optional) and install directory
#source /afs/cern.ch/sw/lcg/contrib/gcc/4.7/x86_64-slc6-gcc47-opt/setup.sh
mkdir local
## Build LHAPDF
wget http://www.hepforge.org/archive/lhapdf/LHAPDF-6.X.Y.tar.gz -O- | tar xz
cd LHAPDF-6.X.Y
./configure --prefix=$PWD/../local
make -j2 && make install
cd ..
## Set environment variables
export PATH=$PWD/local/bin:$PATH
export LD_LIBRARY_PATH=$PWD/local/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$PWD/local/lib64/python2.6/site-packages:$PYTHONPATH
## Test the scripts
lhapdf-config --help
lhapdf list
@section osx Building on Mac OS X
Builds are typically straightforward on Linux, but Mac OS X unfortunately has a
long history of incoherent system compiler setups, which have been worked around
manually by users' private installations of Fink, MacPorts, HomeBrew and manual
tarball installations of required tools. These work-arounds can themselves be
the source of problems when the native compilers or Python libraries get
updated, and due to the ad hoc nature of such installations we are restricted in
how much we can help to get LHAPDF to compile on a broken system: it is the
user's responsibility to make sure that their machine has a consistent set of
build tools!
From experience, the simplest reliable route seems to be to
run a fresh copy of OS X 10.9 Mavericks (or later) without any additional manual
compiler installations: if you use the clang++ compiler on such a system,
LHAPDF6 building should "just work".
@note At the time of writing there is a bug in the Mac Python version which
requires that you call `export CPPFLAGS=-Qunused-arguments` and `export
CFLAGS=-Qunused-arguments` before building. Alternatively you can run the
configure script with `--disable-python`, which avoids the bug at the cost of
not building the very useful Python interface to LHAPDF.
The Mac OS X "Homebrew" system (http://brew.sh/) comes recommended by several
LHAPDF developers. Many HEP packages are already available for Homebrew via the
homebrew-hep project: http://davidchall.github.io/homebrew-hep/ . Success has
also been reported with the MacPorts system (http://www.macports.org/): please
see HepForge's information about MacPorts at https://www.hepforge.org/docs/macosx .
With both these approaches, you should set your environment to *only* use
compilers and Python from the Brew/Ports area and to ignore the system packages:
a hybrid approach will only cause unnecessary pain.
*/