source: trunk/documents/UserDoc/DocBookUsersGuides/InstallationGuide/xml/output.html @ 1208

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

CVS update

File size: 36.4 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>
2  Geant4 Installation Guide
3  </title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="geant4_installation_guide"></a>
4  Geant4 Installation Guide
5  </h1></div><div><h2 class="subtitle">
6  For setting up Geant4 in your computing environment
7  </h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname"></span> <span class="surname">Geant4 Collaboration</span></h3></div></div></div><div><p class="releaseinfo">Version: geant4 9.1</p></div><div><p class="pubdate">14 December, 2007</p></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#chap.InstIntro">1.
8Installation Introduction
9</a></span></dt><dd><dl><dt><span class="sect1"><a href="#sect.Support">
10Supported Computers and Operating Systems
11</a></span></dt><dt><span class="sect1"><a href="#sect.ReqSoft">
12Required Software
13</a></span></dt><dt><span class="sect1"><a href="#sect.VisSoft">
14Visualization Software
15</a></span></dt><dt><span class="sect1"><a href="#sect.SoftAnaHisto">
16Software for Analysis and Histogramming
17</a></span></dt></dl></dd><dt><span class="chapter"><a href="#chap.InstProc">2.
18Installation Procedures
19</a></span></dt><dd><dl><dt><span class="sect1"><a href="#sect.UsingConfig">
20Using the Configure Script for installation
21</a></span></dt><dt><span class="sect1"><a href="#sect.ConfigEnv">
22Configuring the Environment to Use Geant4
23</a></span></dt><dt><span class="sect1"><a href="#sect.InstManually">
24Installing Geant4 Manually
25</a></span></dt><dd><dl><dt><span class="sect2"><a href="#sect.InstManually.ReqEnvVar">
26Required Environment Variables
27</a></span></dt><dt><span class="sect2"><a href="#sect.InstManually.OptEnvVar">
28Optional Environment Variables
29</a></span></dt></dl></dd><dt><span class="sect1"><a href="#sect.IntegGeneFrame">
30Integrating Geant4 into a Generic Framework
31</a></span></dt></dl></dd><dt><span class="chapter"><a href="#chap.TipsWin">3.
32Tips for Installing on Windows
33</a></span></dt><dd><dl><dt><span class="sect1"><a href="#sect.Cygwin">
34Windows with the Cygwin Toolset and Microsoft Visual C++
35</a></span></dt><dt><span class="sect1"><a href="#sect.BuildLibDLLs">
36Building Kernel Libraries DLLs
37</a></span></dt></dl></dd></dl></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="chap.InstIntro"></a>Chapter 1. 
38Installation Introduction
39</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sect.Support">
40Supported Computers and Operating Systems
41</a></span></dt><dt><span class="sect1"><a href="#sect.ReqSoft">
42Required Software
43</a></span></dt><dt><span class="sect1"><a href="#sect.VisSoft">
44Visualization Software
45</a></span></dt><dt><span class="sect1"><a href="#sect.SoftAnaHisto">
46Software for Analysis and Histogramming
47</a></span></dt></dl></div><p>
48This section describes the global computing environment required
49for installing the Geant4 toolkit. To set up your specific
50computing environment for Geant4, refer to Section 2 of this Guide.
51</p><p>
52A shell script (<tt class="literal">Configure</tt>) is provided to
53facilitate the installation procedure, and to help the user set up
54the environment correctly.
55</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.Support"></a>
56Supported Computers and Operating Systems
57</h2></div></div><div></div></div><p>
58Geant4 is supported under the following operating systems:
59
60</p><div class="itemizedlist"><ul type="disc" compact><li><p>
61    Linux on PC with g++ (gcc compiler)
62  </p></li><li><p>
63    MacOSX with g++ (gcc compiler)
64  </p></li><li><p>
65    Windows/XP with MicroSoft Visual C++
66  </p></li></ul></div><p>
67</p><p>
68Currently, this is the set of flavors which can be associated with
69the environment variable <tt class="literal">$G4SYSTEM</tt> to identify the
70system architecture and compiler used:
71
72</p><div class="literallayout"><p><tt class="literal"><br>
73  Linux   - Scientific Linux CERN, SLC4 (or SLC5) <br>
74            g++ gcc 3.4.6 (or 4.1.2)               G4SYSTEM: Linux-g++<br>
75  MacOSX  - MacOSX Darwin 10.5 <br>
76            g++ gcc 4.0.1                          G4SYSTEM: Darwin-g++<br>
77  Windows - Windows XP and Cygwin32<br>
78            MSVC++ 9.0, Visual Studio 2008         G4SYSTEM: WIN32-VC<br>
79</tt></p></div><p>
80</p><p>
81For a more detailed description of supported platforms/compilers
82and versions of third party software, please refer to the release
83notes available with the current release you're using in
84<tt class="literal">geant4/ReleaseNotes</tt> (also accessible from the web
85<a href="http://cern.ch/geant4/support/download.shtml" target="_top">
86distribution page
87</a>
88).
89</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.ReqSoft"></a>
90Required Software
91</h2></div></div><div></div></div><p>
92To run Geant4, the following software must be properly installed in
93your computing environment:
94
95</p><div class="itemizedlist"><ul type="disc" compact><li><p>
96    C++ compiler
97    </p><p>
98    (compiler from Unix vendor, g++ or Visual C++ for Windows systems)
99    </p><p>
100  </p></li><li><p>
101    CLHEP library
102    </p><p>
103    (see CLHEP reference guide
104     <a href="http://cern.ch/clhep/manual/RefGuide/" target="_top">
105     cern.ch/clhep/manual/RefGuide
106     </a>
107    )
108    </p><p>
109  </p></li><li><p>
110    GNU Make (note: g++ preprocessing is used to build file
111    dependencies) is also used and a UNIX shell
112  </p></li><li><p>
113    The Geant4 toolkit source code
114  </p></li></ul></div><p>
115</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.VisSoft"></a>
116Visualization Software
117</h2></div></div><div></div></div><p>
118The above list of software is the minimum required for a
119non-graphical setup of Geant4. To use visualization graphics in
120Geant4 and/or a graphical user interface (GUI), at least one of the
121following graphic systems or packages is required in your computing
122environment:
123
124</p><div class="itemizedlist"><ul type="disc" compact><li><p>
125    X Windows
126  </p></li><li><p>
127    <a href="http://www.opengl.org/" target="_top">
128    OpenGL
129    </a>
130    or
131    <a href="http://www.mesa3d.org/" target="_top">
132    MesaGL
133    </a>
134    (free software compatible with OpenGL)
135  </p></li><li><p>
136    <a href="http://geant4.kek.jp/GEANT4/vis/" target="_top">
137    DAWN
138    </a>
139    , a PostScript renderer
140  </p></li><li><p>
141    <a href="http://www.trolltech.com" target="_top">
142    Qt
143    </a>
144    , a powerfull toolkit
145  </p></li><li><p>
146    <a href="http://oss.sgi.com/projects/inventor/" target="_top">
147    Open Inventor
148    </a>
149    (free software from SGI)
150  </p></li><li><p>
151    <a href="http://openscientist.lal.in2p3.fr/" target="_top">
152    Open Scientist
153    </a>
154    (Interactive environment, including GUI)
155  </p></li><li><p>
156    <a href="http://www.slac.stanford.edu/BFROOT/www/Computing/Graphics/Wired/" target="_top">
157    HepRApp Browser
158    </a>
159    (
160    <a href="http://www.slac.stanford.edu/~perl/heprep/" target="_top">
161    HepRep
162    </a>
163    Browser)
164  </p></li><li><p>
165    <a href="http://wired.freehep.org/" target="_top">
166    WIRED4 JAS Plug-In
167    </a>
168    (
169    <a href="http://www.slac.stanford.edu/~perl/heprep/" target="_top">
170    HepRep
171    </a>
172    Browser)
173  </p></li><li><p>
174    <a href="http://cern.ch/geant4/geant4_public/source/geant4/environments/MOMO/docs/MOMOHelp.html" target="_top">
175    Momo
176    </a>
177    (a
178    <a href="http://java.sun.com/" target="_top">
179    Java
180    </a>
181    -based GUI environment, GGE, GPE, ...)
182  </p></li><li><p>
183    VRML browser
184  </p></li></ul></div><p>
185</p><p>
186Alternatively, you can produce an ascii file for VRML or DAWN.
187</p><p>
188More information is available in Section 8.6, Visualization
189Drivers, of the User's Guide for Application Developers.
190</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.SoftAnaHisto"></a>
191Software for Analysis and Histogramming
192</h2></div></div><div></div></div><p>
193Histogramming facilities are provided through the <span class="bold"><b>AIDA</b></span>
194abstract interface, which in this case needs to be installed as
195well:
196
197</p><div class="itemizedlist"><ul type="disc" compact><li><p>
198    <a href="http://aida.freehep.org/" target="_top">
199    AIDA
200    </a>
201    (Abstract Interfaces for Data Analysis)
202  </p></li></ul></div><p>
203</p><p>
204External, AIDA-compliant packages which provide the necessary
205functionalities for doing histogramming (and therefore, should be
206optionally installed) are:
207
208</p><div class="itemizedlist"><ul type="disc" compact><li><p>
209    <a href="http://iaida.dynalias.net/" target="_top">
210    iAIDA
211    </a>
212    (iAIDA, an implementation of AIDA in C++)
213  </p></li><li><p>
214    <a href="http://jas.freehep.org/jas3/" target="_top">
215    JAS
216    </a>
217    (Java Analysis Studio)
218  </p></li><li><p>
219    <a href="http://openscientist.lal.in2p3.fr/" target="_top">
220    Open Scientist
221    </a>
222    (Interactive Analysis Environment).
223  </p></li><li><p>
224    <a href="http://ilcsoft.desy.de/portal/software_packages/raida/" target="_top">
225    rAIDA
226    </a>
227    (rAIDA, a <a href="http://root.cern.ch/" target="_top">Root</a> implementation of AIDA)
228  </p></li></ul></div><p>
229</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="chap.InstProc"></a>Chapter 2. 
230Installation Procedures
231</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sect.UsingConfig">
232Using the Configure Script for installation
233</a></span></dt><dt><span class="sect1"><a href="#sect.ConfigEnv">
234Configuring the Environment to Use Geant4
235</a></span></dt><dt><span class="sect1"><a href="#sect.InstManually">
236Installing Geant4 Manually
237</a></span></dt><dd><dl><dt><span class="sect2"><a href="#sect.InstManually.ReqEnvVar">
238Required Environment Variables
239</a></span></dt><dt><span class="sect2"><a href="#sect.InstManually.OptEnvVar">
240Optional Environment Variables
241</a></span></dt></dl></dd><dt><span class="sect1"><a href="#sect.IntegGeneFrame">
242Integrating Geant4 into a Generic Framework
243</a></span></dt></dl></div><p>
244
245Before installing Geant4, the required software listed in
246<a href="#sect.ReqSoft" title="
247Required Software
248">the section called &#8220;
249Required Software
250&#8221;</a>
251(and <a href="#sect.VisSoft" title="
252Visualization Software
253">the section called &#8220;
254Visualization Software
255&#8221;</a> in the case of graphics drivers)
256of this Installation Guide must already be installed on
257your system.
258</p><p>
259In this section, a short tutorial on how to install the
260toolkit's kernel libraries is given. The installation of the Geant4
261kernel libraries and the proper configuration of the environment
262can be achieved either manually (by setting the proper environment
263variables) or through the <tt class="literal">Configure</tt> shell script,
264which will allow the installation of just the necessary source code
265and libraries in a specified installation area.
266</p><p>
267<span class="emphasis"><em>Step-by-Step</em></span> guides for the installation are
268also available. See
269<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas06.html" target="_top">
270Appendix - Step-by-Step Installation Guides</a>
271of <span class="emphasis"><em>Geant4 User's Guide - For Application Developers</em></span>.
272</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.UsingConfig"></a>
273Using the <tt class="literal">Configure</tt> Script for installation
274</h2></div></div><div></div></div><p>
275A shell script is provided for building the libraries and to allow
276easy installation in a specified area. The <tt class="literal">Configure</tt>
277shell script is placed in the top directory tree of the
278distribution (<tt class="literal">geant4/Configure</tt>) and allows the user or
279system administrator to install the Geant4 toolkit in a
280semi-automatic way. Some knowledge of the system is required for
281the installation, such as:
282
283</p><div class="itemizedlist"><ul type="disc" compact><li><p>
284    the compiler to be used
285  </p></li><li><p>
286    the path where the Geant4 toolkit is to be installed
287    (<tt class="literal">$G4INSTALL</tt>)
288  </p></li><li><p>
289    definition of installation directory paths (optional)
290  </p></li><li><p>
291    kind of graphics/analysis system(s) installed in the system,
292    and paths to the installation of each graphics/analysis
293    package
294  </p></li><li><p>
295    the kind of library to be generated: static/shared,
296    compound/granular.
297  </p></li></ul></div><p>
298</p><p>
299To run the installer script for building the libraries of the Geant4 toolkit,
300one must type the following from the top directory
301<tt class="literal">geant4</tt>:
302
303</p><div class="informalexample"><pre class="programlisting">
304 &gt; ./Configure -build
305</pre></div><p>
306
307and follow the on-screen instructions. No system administrator
308privileges are required at this stage. The script will ask for the
309path in the system where the Geant4 libraries should be installed
310later on. The script provides default settings for most of the
311environment variables to be set. By pressing -RETURN-, the default
312values will be selected; otherwise the proper selection (or path,
313in case a path is requested) must be typed in.
314</p><p>
315In case the installation procedure fails for some reason, or you
316realise the selected options were not correct at the time the
317installation started, you can repeat the whole process by manually
318removing the current installation with:
319
320</p><div class="informalexample"><pre class="programlisting">
321 &gt; cd geant4/source
322 &gt; make clean
323</pre></div><p>
324where the <tt class="literal">$G4SYSTEM</tt> environment variable (specifying
325the kind of architecture and compiler used) is manually set in your
326environment (according to the flavors listed in
327<a href="#sect.Support" title="
328Supported Computers and Operating Systems
329">the section called &#8220;
330Supported Computers and Operating Systems
331&#8221;</a>).
332</p><p>
333In case new modules must be added to an existing build (for
334example a module for visualization), this can be done manually by
335re-running <tt class="literal">Configure</tt> and providing the new
336settings.
337</p><p>
338Once the process of building the libraries has been completed
339successfully, the Geant4 toolkit can be installed in the specified
340(already existing) installation area by typing:
341
342</p><div class="informalexample"><pre class="programlisting">
343 &gt; ./Configure -install
344</pre></div><p>
345</p><p>
346Libraries and necessary source code will be installed in
347<tt class="literal">lib/geant4</tt>, <tt class="literal">include/geant4</tt> (if selected to
348install all headers in a single directory), <tt class="literal">src/geant4</tt>,
349respectively. System administrator privileges may be required for the
350installation stage, depending upon where in the system the installation
351should happen.
352</p><p>
353<tt class="literal">$G4INSTALL</tt> will be set to
354<tt class="literal">[INSTALLATION_AREA]/src/geant4</tt>.
355</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.ConfigEnv"></a>
356Configuring the Environment to Use Geant4
357</h2></div></div><div></div></div><p>
358Once libraries have been installed, the user's environment must be
359correctly set up for the usage of the Geant4 toolkit. The
360<tt class="literal">Configure</tt> script provides a way to check the existing
361installation and provide the correct configuration for the user's
362environment. Configuration scripts <tt class="literal">env[.sh.csh]</tt> can be
363generated, and should be sourced by the final users in order to
364configure their environment according to the performed
365installation.
366</p><p>
367To generate the configuration scripts, the user should run
368<tt class="literal">Configure</tt> placed in the installation area, as follows:
369
370</p><div class="informalexample"><pre class="programlisting">
371 &gt; $G4INSTALL/Configure
372</pre></div><p>
373</p><p>
374This will generate the shell script <tt class="literal">env.csh</tt>
375(<tt class="literal">env.sh</tt> for <tt class="literal">bash</tt> shell) to be sourced or
376integrated into the shell login script (<tt class="literal">.tcshrc</tt> or
377<tt class="literal">.bashrc</tt>). The shell script will be generated in the
378user's current directory (<tt class="literal">$PWD</tt>). The user can
379customize it to specify for example her/his proper working
380directory through the variable <tt class="literal">$G4WORKDIR</tt>. Once the
381generated script is sourced, the user will be ready to start
382building a Geant4 application.
383</p><p>
384Refer to section the section
385<span class="emphasis"><em>
386Getting Started with Geant4 - How to Make an Executable Program
387</em></span>
388of the
389<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html" target="_top"> 
390Geant4 User's Guide for Application Developers
391</a> 
392for information on how to build an executable in Geant4.
393</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.InstManually"></a>
394Installing Geant4 Manually
395</h2></div></div><div></div></div><p>
396Before proceeding with the installation, some key environment
397variables must be defined in your user environment in order to
398specify where all software components are to be placed and to set
399some compilation options. A complete reference to all environment
400variables in Geant4 is available in section
401
402<span class="emphasis"><em>
403Appendix - Makefiles and Environment Variables
404</em></span>
405of the
406<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html" target="_top"> 
407Geant4 User's Guide for Application Developers
408</a>.
409</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.InstManually.ReqEnvVar"></a>
410Required Environment Variables
411</h3></div></div><div></div></div><div class="variablelist"><p class="title"><b></b></p><dl><dt><span class="term">
412    <tt class="literal">G4SYSTEM:</tt>
413  </span></dt><dd><p>
414    set to one of the flavors listed in section 1.1 to specify the
415    kind of architecture and compiler used
416  </p></dd><dt><span class="term">
417    <tt class="literal">G4INSTALL:</tt>
418  </span></dt><dd><p>
419    path where the Geant4 toolkit tree is installed (ex.
420    <tt class="literal">$HOME/geant4</tt>)
421  </p></dd><dt><span class="term">
422    <tt class="literal">CLHEP_BASE_DIR:</tt>
423  </span></dt><dd><p>
424    path to the CLHEP installation
425  </p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.InstManually.OptEnvVar"></a>
426Optional Environment Variables
427</h3></div></div><div></div></div><div class="variablelist"><p class="title"><b></b></p><dl><dt><span class="term">
428    <tt class="literal">G4WORKDIR:</tt>
429  </span></dt><dd><p>
430    path of the user's working directory (default in
431    <tt class="literal">$G4INSTALL</tt>)
432  </p></dd><dt><span class="term">
433    <tt class="literal">G4LIB:</tt>
434  </span></dt><dd><p>
435    path where the kernel libraries should be installed (default in
436    <tt class="literal">$G4INSTALL/lib</tt>)
437  </p></dd><dt><span class="term">
438    <tt class="literal">G4TMP:</tt>
439  </span></dt><dd><p>
440    path where temporary files (object files, dependency files) are
441    placed (default in <tt class="literal">$G4WORKDIR/tmp)</tt>
442  </p></dd><dt><span class="term">
443    <tt class="literal">G4BIN:</tt>
444  </span></dt><dd><p>
445    path where final executable files are placed (default in
446    <tt class="literal">$G4WORKDIR/bin)</tt>.
447  </p></dd><dt><span class="term">
448    <tt class="literal">G4INCLUDE:</tt>
449  </span></dt><dd><p>
450    path where source header files may be mirrored at installation
451    by issuing <tt class="literal">make includes</tt> (default in
452    <tt class="literal">$G4INSTALL/include</tt>)
453  </p></dd><dt><span class="term">
454    <tt class="literal">G4DEBUG:</tt>
455  </span></dt><dd><p>
456    flag specifying that libraries be built with debug symbols
457    (requires a lot of disk space). The default is optimised-mode
458  </p></dd><dt><span class="term">
459    <tt class="literal">G4LIB_BUILD_SHARED:</tt>
460  </span></dt><dd><p>
461    flag specifying that kernel libraries be built as shared
462    libraries (libraries will then be used by default). If not set,
463    static archive libraries are built by default
464  </p></dd><dt><span class="term">
465    <tt class="literal">G4LIB_BUILD_STATIC:</tt>
466  </span></dt><dd><p>
467    flag specifying that kernel libraries be built as static
468    archive libraries. Note that you may specify this flag in addition
469    to <tt class="literal">G4LIB_BUILD_SHARED</tt> to build shared and static
470    libraries simultaneously.
471  </p></dd><dt><span class="term">
472    <tt class="literal">G4LIB_BUILD_G3TOG4:</tt>
473  </span></dt><dd><p>
474    flag specifying that the library for the g3tog4 module be
475    built. By default the library will not be built.
476  </p></dd><dt><span class="term">
477    <tt class="literal">G4LIB_BUILD_ZLIB:</tt>
478  </span></dt><dd><p>
479    flag specifying that an additional library for file compression
480    should be built (not required on Linux/Unix systems). By default
481    the library will not be built.
482  </p></dd><dt><span class="term">
483    <tt class="literal">G4_NO_VERBOSE:</tt>
484  </span></dt><dd><p>
485    defining this flag prevents the compilation of verbosity code
486    (for better performance). The default is with verbosity on.
487  </p></dd></dl></div><p>
488The list of all additional flags (also requiring third-party packages
489installed) can be found in
490<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html#sect.MkflEnvVar.EnvVar" target="_top">Section 5.2</a>
491of the
492<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html" target="_top"> 
493Geant4 User's Guide for Application Developers
494</a>.
495</p><p>
496The Geant4 installation requires native STL (the Standard Template
497Library) as the base foundation class library. This also implies
498strict ISO-ANSI language compliance. In addition to the above, you
499might want to set the proper environment for visualization, such
500as:
501
502</p><div class="itemizedlist"><ul type="disc" compact><li><p>
503    the kind of graphics driver(s) installed in the system
504  </p></li><li><p>
505    the path to the installation of each graphics driver
506  </p></li></ul></div><p>
507
508in case you want to build the Geant4 kernel libraries with the
509graphics drivers built-in. See
510
511<span class="emphasis"><em>
512Visualization - The Visualization Drivers
513</em></span>
514of the
515<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html" target="_top"> 
516Geant4 User's Guide for Application Developers
517</a>.
518</p><p>
519At this point, you may choose one of two ways to compile and
520install the kernel libraries, depending on your needs and system
521resources. From <tt class="literal">$G4INSTALL/source</tt>:
522
523</p><div class="orderedlist"><ol type="1" compact><li><p>
524    <tt class="literal">make</tt>
525    </p><p>
526    This will make one library for each "leaf" category (maximum
527    library granularity) and automatically produce a map of library use
528    and dependencies.</p><p>
529  </p></li><li><p>
530    <tt class="literal">make global</tt>
531    </p><p>
532    This will make global libraries, one for each major category.
533    </p><p>
534  </p></li></ol></div><p>
535</p><p>
536The main advantage of the first approach is the speed of building
537the libraries and of the application, which in some cases can be
538improved by a factor of two or three compared to the "global
539library" approach.
540</p><p>
541Using the "granular library" approach a fairly large number
542(roughly 90) of "leaf" libraries is produced. However, the
543dependencies and linking list are evaluated and generated
544automatically on the fly. The top-level <tt class="literal">GNUmakefile</tt> in
545<tt class="literal">$G4INSTALL/source</tt> parses the dependency files of
546Geant4 and produces a file <tt class="literal">libname.map</tt> in
547<tt class="literal">$G4LIB</tt>. <tt class="literal">libname.map</tt> is produced by the
548tool <tt class="literal">liblist</tt>, whose source code is in
549<tt class="literal">$G4INSTALL/config</tt>.
550</p><p>
551When building a binary application the script
552<tt class="literal">binmake.gmk</tt> in <tt class="literal">$G4INSTALL/config</tt> will
553parse the user's dependency files and use <tt class="literal">libname.map</tt>
554to determine through <tt class="literal">liblist</tt> the required libraries to
555add to the linking list. Only the required libraries will be loaded
556in the link command.
557</p><p>
558The command <tt class="literal">make libmap</tt> issued from
559<tt class="literal">$G4INSTALL/source</tt>, allows manual rebuilding of the
560dependency map. The command is issued by default in the normal
561build process for granular libraries.
562</p><p>
563It is possible to install both "granular" and "compound" libraries,
564by typing "make" and "make global" in sequence. In this case, to
565choose usage of granular libraries at link time one should set the
566flag G4LIB_USE_GRANULAR in the environment; otherwise compound
567libraries will be adopted by default.
568</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.IntegGeneFrame"></a>
569Integrating Geant4 into a Generic Framework
570</h2></div></div><div></div></div><p>
571As part of the Geant4 kernel libraries installation, it is also
572possible to put the entire set of header files in a single place,
573which is determined by the environment variable
574<tt class="literal">G4INCLUDE</tt> specifying the directory path. Therefore,
575it's rather straightforward to integrate Geant4 into a generic
576external framework, by simply knowing the path where header files
577are located in the system (<tt class="literal">G4INCLUDE</tt>) and where
578installed libraries are placed (<tt class="literal">G4LIB</tt>).
579</p><p>
580In <a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html#sect.MkflEnvVar.EnvVar" target="_top">Section 5.2</a>.
581(<span class="emphasis"><em>Appendix - Makefiles and Environment Variables</em></span>)
582of the
583<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/index.html" target="_top"> 
584Geant4 User's Guide for Application Developers
585</a>,
586you can find a list of all the environment variables. In
587<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas05.html#sect.MkflEnvVar.LnkExtLib" target="_top">Section 5.3</a>
588it is also explained how to integrate external libraries which may or
589may not use the Geant4 kernel libraries, using the <tt class="literal">GNUmake</tt> 
590build system of Geant4.
591</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="chap.TipsWin"></a>Chapter 3. 
592Tips for Installing on Windows
593</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#sect.Cygwin">
594Windows with the Cygwin Toolset and Microsoft Visual C++
595</a></span></dt><dt><span class="sect1"><a href="#sect.BuildLibDLLs">
596Building Kernel Libraries DLLs
597</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.Cygwin"></a>
598Windows with the Cygwin Toolset and Microsoft Visual C++
599</h2></div></div><div></div></div><p>
600To compile and run Geant4 under Windows systems, some additional
601information and tools are required, although the installation
602produre is similar to that required on a UNIX based system. On
603Windows, the Cygwin toolset and the Microsoft Visual C++ compiler
604are used.
605</p><p>
606Cygwin32 is a UNIX development environment available for Microsoft
607Windows. You can freely obtain Cygwin32 from
608<a href="http://cygwin.com/" target="_top">
609Cygwin
610</a>
611or
612<a href="http://x.cygwin.com/" target="_top">
613Cygwin/X
614</a>
615.
616</p><p>
617We do not support direct use of Visual Studio; i.e. we do not
618provide Visual Studio workspace (.dsw) or project (.dsp) files, nor
619we do provide makefiles for the <tt class="literal">nmake</tt> application of MS
620Visual C++.
621</p><p>
622We use several of the tools provided by the Cygwin toolset:
623
624</p><div class="itemizedlist"><ul type="disc" compact><li><p>
625    <tt class="literal">make.exe</tt> as a make tool
626  </p></li><li><p>
627    <tt class="literal">g++.exe</tt> as a tool to analyse source file dependencies
628    and create dependency (<tt class="literal">.d</tt>) files
629  </p></li><li><p>
630    several other unix tools like <tt class="literal">cp</tt>, <tt class="literal">mv</tt>,
631    <tt class="literal">rm</tt>, <tt class="literal">touch</tt>, etc.
632  </p></li></ul></div><p>
633</p><p>
634At the installation of the Cygwin toolset it is therefore required
635to explicitely select some packages (i.e. <span class="emphasis"><em>gmake</em></span>,
636<span class="emphasis"><em>gcc</em></span>, <span class="emphasis"><em>binutils</em></span> 
637and <span class="emphasis"><em>tcsh</em></span> from the "devel" category) in
638addition to those which are part of the default installation.
639</p><p>
640For more details on the toolset, please see the documentation
641available on the
642<a href="http://cygwin.com/" target="_top">
643Cygwin pages
644</a>
645.
646The User's Guide has quick start guides and help with
647setting up Cygwin with <tt class="literal">setup.exe</tt>.
648</p><p>
649Links to some installation tips for the Cygwin toolset and also
650"step by step" installation guides can be found in the section
651<a href="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas06.html" target="_top">
652Appendix - Step-by-Step Installation Guides - Build for MS Visual C++
653</a> 
654of <span class="emphasis"><em>Geant4 User's Guide - For Application Developers</em></span>.
655</p><p>
656The usage of Cygwin32 for the build environment results in a
657build procedure similar to that on a UNIX system.
658</p><p>
659The following steps are required to install geant4:
660
661</p><div class="orderedlist"><ol type="1" compact><li><p>
662    Install Cygwin (see also notes above and additional
663    <a href="http://cern.ch/geant4/support/windows_note.shtml" target="_top">installation
664    notes</a> for known issues related to the most current version):
665    </p><p>
666    We do not depend on any specific feature of the version of Cygwin,
667    so newer versions (or slightly older) are expected to work.
668    </p><p>
669  </p></li><li><p>
670    Set the environment for MS Visual C++, i.e. set the paths to
671    libraries, include files, and executables for MS Visual C++. This
672    can be done by modifying the start-up batch file
673    <tt class="literal">cygwin.bat</tt> of Cygwin32 to include all the MSDOS commands
674    found in the file <tt class="literal">vcvars32.bat</tt> provided in MS Visual C++
675   (in the VC++ .NET compiler installation directory, and usually
676   located inside the <tt class="literal">Common7/Tools</tt> directory). This
677   modification should be done after the installation of the Cygwin
678   toolset, so that the environment gets properly set at the time of
679   the invocation of the shell.
680  </p></li><li><p>
681    Unpack the source code into a directory of your choice.
682  </p></li><li><p>
683    Start the <tt class="literal">Cygwin</tt> shell from the start menu.
684  </p></li><li><p>
685    At this point you're ready to install Geant4. If manual
686    installation is chosen, you must set the necessary environment
687    variables. There are various ways to do so; for example through a
688    command file for the Cygwin bash shell. This command file could be
689    named <tt class="literal">geant4-setup.sh</tt>, and you must execute it with
690
691    </p><div class="informalexample"><pre class="programlisting">
692        . geant4-setup.sh
693    </pre></div><p>
694
695    including the leading dot and blank space. You could also have this
696    as your <tt class="literal">.bashrc</tt> file. The commands in the command file
697    should be:
698
699    </p><div class="informalexample"><pre class="programlisting">
700        # Set G4SYSTEM
701        export G4SYSTEM=WIN32-VC
702        #
703        # Set Path to CLHEP
704        export CLHEP_BASE_DIR=C:/usr/local
705        #
706        # --- Other optional settings
707        #Turn on verbose to show command used for compilation
708        #export CPPVERBOSE=1
709        #
710    </pre></div><p>
711    Note, in the example above, CLHEP was installed in
712    <tt class="literal">C:/usr/local</tt>, therefore <tt class="literal">include/CLHEP</tt> and
713    <tt class="literal">lib/CLHEP.lib</tt> must be included therein.
714  </p></li><li><p>
715    Once the environment is correctly set, the libraries are built
716    using make from the <tt class="literal">geant4/source</tt> directory typing
717    <tt class="literal">make</tt> from the <tt class="literal">Cygwin bash</tt> shell
718    prompt.
719  </p></li></ol></div><p>
720</p><p>
721Examples can be built in the same way as the libraries from
722examples/novice/N01, for instance: type <tt class="literal">make</tt> from the
723shell prompt.
724</p><p>
725Note that, depending on which external software is used, there may
726be some warnings in linking about conflictings libraries. This often
727seems to be caused by an external library compiled for a different
728run time environment.
729</p><p>
730The binary of the example is placed by default into the
731<tt class="literal">geant4/bin/WIN32-VC</tt> directory. You may run it either from
732this directory or from the <tt class="literal">examples/novice/N01</tt> directory;
733sample input and output files are placed in each of the
734<tt class="literal">examples/novice</tt> directories. Some of the examples will
735need to read data files, and the place has to be given in
736environment variables again similar to the following example:
737
738</p><div class="informalexample"><pre class="programlisting">
739        #
740        # Environment variables needed to find geant4 data files:
741        #
742        # Data for neutron scattering processes,
743        #    distributed in a separate tar file, then placed under data
744        export G4NEUTRONHPDATA=c:/usr/local/geant4/data/G4NDL
745        #
746        # Nuclear Photon evaporation data,
747        #    distributed with the source files under data
748        export G4LEVELGAMMADATA=c:/usr/local/geant4/data/PhotonEvaporation
749        #
750        # Data for radiative decay hadronic processes under data,
751        #    distributed in a separate tar file
752        export G4RADIOACTIVEDATA=c:/usr/local/geant4/data/RadiativeDecay
753        #
754        # Data for low energy electromagnetic processes,
755        #    distributed in a separate tar file, then placed under data
756        export G4LEDATA=c:/usr/local/geant4/data/G4EMLOW
757        #
758        # Data for nuclear shell effects for INCL/ABLA hadronic model,
759        #    distributed in a separate tar file, then placed under data
760        export G4ABLADATA=c:/usr/local/geant4/data/G4ABLA
761        #
762</pre></div><p>
763</p><p>
764All compiler and linker options are set in
765<tt class="literal">config/sys/WIN32-VC.gmk</tt>. If you require options different
766from our choice, you can modify this file.
767</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.BuildLibDLLs"></a>
768Building Kernel Libraries DLLs
769</h2></div></div><div></div></div><p>
770DLLs (Dynamic Link Libraries) on Windows are supported for MS-VC++
771and can be built for the <tt class="literal">compound</tt> kernel libraries of
772Geant4 (see <a href="#sect.InstManually.OptEnvVar" title="
773Optional Environment Variables
774">the section called &#8220;
775Optional Environment Variables
776&#8221;</a> of the
777Installation Procedure of this Guide for a dissertation on
778<tt class="literal">global/compound</tt> libraries).
779</p><p>
780The libraries can be built either manually, issuing the
781command:
782
783</p><div class="informalexample"><pre class="programlisting">
784        make dll
785</pre></div><p>
786
787from the directory <tt class="literal">$G4INSTALL/source</tt> or by specifying it
788through the <tt class="literal">Configure</tt> script used for the
789installation.
790</p><p>
791Then, to build any application making use of the installed DLLs,
792the environment variable <tt class="literal">G4LIB_USE_DLL</tt> must be set in the
793environment.
794</p><p>
795Once the application is built, it is required to specify to the
796system the path where the DLLs are installed. To do so, add the
797absolute path (in Cygwin format) of the DLLs installation directory
798to the <tt class="literal">PATH</tt> variable; for example:
799
800</p><div class="informalexample"><pre class="programlisting">
801        export PATH=$PATH:/usr/local/geant4/lib/$G4SYSTEM
802</pre></div><p>
803</p><p>
804You may then be able to run successfully your application.
805</p></div></div></div></body></html>
Note: See TracBrowser for help on using the repository browser.