source: trunk/documents/UserDoc/DocBookUsersGuides/InstallationGuide/xml/UnixMachines/unixMachines.xml @ 1358

Last change on this file since 1358 was 1211, checked in by garnier, 15 years ago

CVS update

File size: 16.4 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
5<!--                                                          -->
6<!-- ******************************************************** -->
7
8<para>
9
10Before installing Geant4, the required software listed in
11<xref linkend="sect.ReqSoft" />
12(and <xref linkend="sect.VisSoft" /> in the case of graphics drivers)
13of this Installation Guide must already be installed on
14your system.
15</para>
16
17<para>
18In this section, a short tutorial on how to install the
19toolkit's kernel libraries is given. The installation of the Geant4
20kernel libraries and the proper configuration of the environment
21can be achieved either manually (by setting the proper environment
22variables) or through the <literal>Configure</literal> shell script,
23which will allow the installation of just the necessary source code
24and libraries in a specified installation area.
25</para>
26
27<para>
28<emphasis>Step-by-Step</emphasis> guides for the installation are
29also available. See
30<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas06.html">
31Appendix - Step-by-Step Installation Guides</ulink>
32of <emphasis>Geant4 User's Guide - For Application Developers</emphasis>.
33</para>
34
35<!-- ******************* Section (Level#1) ****************** -->
36<sect1 id="sect.UsingConfig">
37<title>
38Using the <literal>Configure</literal> Script for installation
39</title>
40
41<para>
42A shell script is provided for building the libraries and to allow
43easy installation in a specified area. The <literal>Configure</literal>
44shell script is placed in the top directory tree of the
45distribution (<literal>geant4/Configure</literal>) and allows the user or
46system administrator to install the Geant4 toolkit in a
47semi-automatic way. Some knowledge of the system is required for
48the installation, such as:
49
50<itemizedlist spacing="compact">
51  <listitem><para>
52    the compiler to be used
53  </para></listitem>
54  <listitem><para>
55    the path where the Geant4 toolkit is to be installed
56    (<literal>$G4INSTALL</literal>)
57  </para></listitem>
58  <listitem><para>
59    definition of installation directory paths (optional)
60  </para></listitem>
61  <listitem><para>
62    kind of graphics/analysis system(s) installed in the system,
63    and paths to the installation of each graphics/analysis
64    package
65  </para></listitem>
66  <listitem><para>
67    the kind of library to be generated: static/shared,
68    compound/granular.
69  </para></listitem>
70</itemizedlist>
71</para>
72
73<para>
74To run the installer script for building the libraries of the Geant4 toolkit,
75one must type the following from the top directory
76<literal>geant4</literal>:
77
78<informalexample>
79<programlisting>
80 &gt; ./Configure -build
81</programlisting>
82</informalexample>
83
84and follow the on-screen instructions. No system administrator
85privileges are required at this stage. The script will ask for the
86path in the system where the Geant4 libraries should be installed
87later on. The script provides default settings for most of the
88environment variables to be set. By pressing -RETURN-, the default
89values will be selected; otherwise the proper selection (or path,
90in case a path is requested) must be typed in.
91</para>
92
93<para>
94In case the installation procedure fails for some reason, or you
95realise the selected options were not correct at the time the
96installation started, you can repeat the whole process by manually
97removing the current installation with:
98
99<informalexample>
100<programlisting>
101 &gt; cd geant4/source
102 &gt; make clean
103</programlisting>
104</informalexample>
105where the <literal>$G4SYSTEM</literal> environment variable (specifying
106the kind of architecture and compiler used) is manually set in your
107environment (according to the flavors listed in
108<xref linkend="sect.Support" />).
109</para>
110
111<para>
112In case new modules must be added to an existing build (for
113example a module for visualization), this can be done manually by
114re-running <literal>Configure</literal> and providing the new
115settings.
116</para>
117
118<para>
119Once the process of building the libraries has been completed
120successfully, the Geant4 toolkit can be installed in the specified
121(already existing) installation area by typing:
122
123<informalexample>
124<programlisting>
125 &gt; ./Configure -install
126</programlisting>
127</informalexample>
128</para>
129
130<para>
131Libraries and necessary source code will be installed in
132<literal>lib/geant4</literal>, <literal>include/geant4</literal> (if selected to
133install all headers in a single directory), <literal>src/geant4</literal>,
134respectively. System administrator privileges may be required for the
135installation stage, depending upon where in the system the installation
136should happen.
137</para>
138
139<para>
140<literal>$G4INSTALL</literal> will be set to
141<literal>[INSTALLATION_AREA]/src/geant4</literal>.
142</para>
143
144</sect1>
145
146<!-- ******************* Section (Level#1) ****************** -->
147<sect1 id="sect.ConfigEnv">
148<title>
149Configuring the Environment to Use Geant4
150</title>
151
152<para>
153Once libraries have been installed, the user's environment must be
154correctly set up for the usage of the Geant4 toolkit. The
155<literal>Configure</literal> script provides a way to check the existing
156installation and provide the correct configuration for the user's
157environment. Configuration scripts <literal>env[.sh.csh]</literal> can be
158generated, and should be sourced by the final users in order to
159configure their environment according to the performed
160installation.
161</para>
162
163<para>
164To generate the configuration scripts, the user should run
165<literal>Configure</literal> placed in the installation area, as follows:
166
167<informalexample>
168<programlisting>
169 &gt; $G4INSTALL/Configure
170</programlisting>
171</informalexample>
172</para>
173
174<para>
175This will generate the shell script <literal>env.csh</literal>
176(<literal>env.sh</literal> for <literal>bash</literal> shell) to be sourced or
177integrated into the shell login script (<literal>.tcshrc</literal> or
178<literal>.bashrc</literal>). The shell script will be generated in the
179user's current directory (<literal>$PWD</literal>). The user can
180customize it to specify for example her/his proper working
181directory through the variable <literal>$G4WORKDIR</literal>. Once the
182generated script is sourced, the user will be ready to start
183building a Geant4 application.
184</para>
185
186<para>
187Refer to section the section
188<emphasis>
189Getting Started with Geant4 - How to Make an Executable Program
190</emphasis>
191of the
192<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html"> 
193Geant4 User's Guide for Application Developers
194</ulink> 
195for information on how to build an executable in Geant4.
196</para>
197
198</sect1>
199
200
201<!-- ******************* Section (Level#1) ****************** -->
202<sect1 id="sect.InstManually">
203<title>
204Installing Geant4 Manually
205</title>
206
207<para>
208Before proceeding with the installation, some key environment
209variables must be defined in your user environment in order to
210specify where all software components are to be placed and to set
211some compilation options. A complete reference to all environment
212variables in Geant4 is available in section
213
214<emphasis>
215Appendix - Makefiles and Environment Variables
216</emphasis>
217of the
218<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html"> 
219Geant4 User's Guide for Application Developers
220</ulink>.
221</para>
222
223<!-- ******************* Section (Level#2) ****************** -->
224<sect2 id="sect.InstManually.ReqEnvVar">
225<title>
226Required Environment Variables
227</title>
228
229<variablelist><title></title>
230<varlistentry>
231  <term>
232    <literal>G4SYSTEM:</literal>
233  </term>
234  <listitem><para>
235    set to one of the flavors listed in section 1.1 to specify the
236    kind of architecture and compiler used
237  </para></listitem>
238</varlistentry>
239<varlistentry>
240  <term>
241    <literal>G4INSTALL:</literal>
242  </term>
243  <listitem><para>
244    path where the Geant4 toolkit tree is installed (ex.
245    <literal>$HOME/geant4</literal>)
246  </para></listitem>
247</varlistentry>
248<varlistentry>
249  <term>
250    <literal>CLHEP_BASE_DIR:</literal>
251  </term>
252  <listitem><para>
253    path to the CLHEP installation
254  </para></listitem>
255</varlistentry>
256</variablelist>
257
258</sect2>
259
260<!-- ******************* Section (Level#2) ****************** -->
261<sect2 id="sect.InstManually.OptEnvVar">
262<title>
263Optional Environment Variables
264</title>
265
266<variablelist><title></title>
267<varlistentry>
268  <term>
269    <literal>G4WORKDIR:</literal>
270  </term>
271  <listitem><para>
272    path of the user's working directory (default in
273    <literal>$G4INSTALL</literal>)
274  </para></listitem>
275</varlistentry>
276<varlistentry>
277  <term>
278    <literal>G4LIB:</literal>
279  </term>
280  <listitem><para>
281    path where the kernel libraries should be installed (default in
282    <literal>$G4INSTALL/lib</literal>)
283  </para></listitem>
284</varlistentry>
285<varlistentry>
286  <term>
287    <literal>G4TMP:</literal>
288  </term>
289  <listitem><para>
290    path where temporary files (object files, dependency files) are
291    placed (default in <literal>$G4WORKDIR/tmp)</literal>
292  </para></listitem>
293</varlistentry>
294<varlistentry>
295  <term>
296    <literal>G4BIN:</literal>
297  </term>
298  <listitem><para>
299    path where final executable files are placed (default in
300    <literal>$G4WORKDIR/bin)</literal>.
301  </para></listitem>
302</varlistentry>
303<varlistentry>
304  <term>
305    <literal>G4INCLUDE:</literal>
306  </term>
307  <listitem><para>
308    path where source header files may be mirrored at installation
309    by issuing <literal>make includes</literal> (default in
310    <literal>$G4INSTALL/include</literal>)
311  </para></listitem>
312</varlistentry>
313<varlistentry>
314  <term>
315    <literal>G4DEBUG:</literal>
316  </term>
317  <listitem><para>
318    flag specifying that libraries be built with debug symbols
319    (requires a lot of disk space). The default is optimised-mode
320  </para></listitem>
321</varlistentry>
322<varlistentry>
323  <term>
324    <literal>G4LIB_BUILD_SHARED:</literal>
325  </term>
326  <listitem><para>
327    flag specifying that kernel libraries be built as shared
328    libraries (libraries will then be used by default). If not set,
329    static archive libraries are built by default
330  </para></listitem>
331</varlistentry>
332<varlistentry>
333  <term>
334    <literal>G4LIB_BUILD_STATIC:</literal>
335  </term>
336  <listitem><para>
337    flag specifying that kernel libraries be built as static
338    archive libraries. Note that you may specify this flag in addition
339    to <literal>G4LIB_BUILD_SHARED</literal> to build shared and static
340    libraries simultaneously.
341  </para></listitem>
342</varlistentry>
343<varlistentry>
344  <term>
345    <literal>G4LIB_BUILD_G3TOG4:</literal>
346  </term>
347  <listitem><para>
348    flag specifying that the library for the g3tog4 module be
349    built. By default the library will not be built.
350  </para></listitem>
351</varlistentry>
352<varlistentry>
353  <term>
354    <literal>G4LIB_BUILD_ZLIB:</literal>
355  </term>
356  <listitem><para>
357    flag specifying that an additional library for file compression
358    should be built (not required on Linux/Unix systems, required on
359    Windows if choosing OpenGL or OpenInventor visualization). By default
360    the library will not be built.
361  </para></listitem>
362</varlistentry>
363<varlistentry>
364  <term>
365    <literal>G4_NO_VERBOSE:</literal>
366  </term>
367  <listitem><para>
368    defining this flag prevents the compilation of verbosity code
369    (for better performance). The default is with verbosity on.
370  </para></listitem>
371</varlistentry>
372</variablelist>
373
374<para>
375The list of all additional flags (also requiring third-party packages
376installed) can be found in
377<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html#sect.MkflEnvVar.EnvVar">Section 5.2</ulink>
378of the
379<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html"> 
380Geant4 User's Guide for Application Developers
381</ulink>.
382</para>
383
384<para>
385The Geant4 installation requires native STL (the Standard Template
386Library) as the base foundation class library. This also implies
387strict ISO-ANSI language compliance. In addition to the above, you
388might want to set the proper environment for visualization, such
389as:
390
391<itemizedlist spacing="compact">
392  <listitem><para>
393    the kind of graphics driver(s) installed in the system
394  </para></listitem>
395  <listitem><para>
396    the path to the installation of each graphics driver
397  </para></listitem>
398</itemizedlist>
399
400in case you want to build the Geant4 kernel libraries with the
401graphics drivers built-in. See
402
403<emphasis>
404Visualization - The Visualization Drivers
405</emphasis>
406of the
407<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html"> 
408Geant4 User's Guide for Application Developers
409</ulink>.
410</para>
411
412<para>
413At this point, you may choose one of two ways to compile and
414install the kernel libraries, depending on your needs and system
415resources. From <literal>$G4INSTALL/source</literal>:
416
417<orderedlist spacing="compact">
418  <listitem><para>
419    <literal>make</literal>
420    <para>
421    This will make one library for each "leaf" category (maximum
422    library granularity) and automatically produce a map of library use
423    and dependencies.</para>
424  </para></listitem>
425  <listitem><para>
426    <literal>make global</literal>
427    <para>
428    This will make global libraries, one for each major category.
429    </para>
430  </para></listitem>
431</orderedlist>
432</para>
433
434<para>
435The main advantage of the first approach is the speed of building
436the libraries and of the application, which in some cases can be
437improved by a factor of two or three compared to the "global
438library" approach.
439</para>
440
441<para>
442Using the "granular library" approach a fairly large number
443(roughly 90) of "leaf" libraries is produced. However, the
444dependencies and linking list are evaluated and generated
445automatically on the fly. The top-level <literal>GNUmakefile</literal> in
446<literal>$G4INSTALL/source</literal> parses the dependency files of
447Geant4 and produces a file <literal>libname.map</literal> in
448<literal>$G4LIB</literal>. <literal>libname.map</literal> is produced by the
449tool <literal>liblist</literal>, whose source code is in
450<literal>$G4INSTALL/config</literal>.
451</para>
452
453<para>
454When building a binary application the script
455<literal>binmake.gmk</literal> in <literal>$G4INSTALL/config</literal> will
456parse the user's dependency files and use <literal>libname.map</literal>
457to determine through <literal>liblist</literal> the required libraries to
458add to the linking list. Only the required libraries will be loaded
459in the link command.
460</para>
461
462<para>
463The command <literal>make libmap</literal> issued from
464<literal>$G4INSTALL/source</literal>, allows manual rebuilding of the
465dependency map. The command is issued by default in the normal
466build process for granular libraries.
467</para>
468
469<para>
470It is possible to install both "granular" and "compound" libraries,
471by typing "make" and "make global" in sequence. In this case, to
472choose usage of granular libraries at link time one should set the
473flag G4LIB_USE_GRANULAR in the environment; otherwise compound
474libraries will be adopted by default.
475</para>
476
477</sect2>
478</sect1>
479
480<!-- ******************* Section (Level#1) ****************** -->
481<sect1 id="sect.IntegGeneFrame">
482<title>
483Integrating Geant4 into a Generic Framework
484</title>
485
486<para>
487As part of the Geant4 kernel libraries installation, it is also
488possible to put the entire set of header files in a single place,
489which is determined by the environment variable
490<literal>G4INCLUDE</literal> specifying the directory path. Therefore,
491it's rather straightforward to integrate Geant4 into a generic
492external framework, by simply knowing the path where header files
493are located in the system (<literal>G4INCLUDE</literal>) and where
494installed libraries are placed (<literal>G4LIB</literal>).
495</para>
496
497<para>
498In <ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html#sect.MkflEnvVar.EnvVar">Section 5.2</ulink>.
499(<emphasis>Appendix - Makefiles and Environment Variables</emphasis>)
500of the
501<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html"> 
502Geant4 User's Guide for Application Developers
503</ulink>,
504you can find a list of all the environment variables. In
505<ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html#sect.MkflEnvVar.LnkExtLib">Section 5.3</ulink>
506it is also explained how to integrate external libraries which may or
507may not use the Geant4 kernel libraries, using the <literal>GNUmake</literal> 
508build system of Geant4.
509</para>
510
511</sect1>
Note: See TracBrowser for help on using the repository browser.