source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/Appendix/tipsCompilation.xml

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

CVS update

File size: 4.2 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
5<!--                                                          -->
6<!-- ******************************************************** -->
7
8
9<!-- ******************* Section (Level#1) ****************** -->
10<sect1 id="sect.TpPrgCmp">
11<title>
12Tips for Program Compilation
13</title>
14
15<para>
16This section is dedicated to illustrate and justify some of the
17options used and fixed by default in the compilation of the Geant4
18toolkit. It is also meant to be a simple guide for the
19user/installer to avoid or overcome problems which may occur on
20some compilers. Solutions proposed here are based on the experience
21gained while porting the Geant4 code to different
22architectures/compilers and are specific to the OS's and compiler's
23version valid at the current time of writing of this manual.
24</para>
25
26<para>
27It's well known that each compiler adopts its own internal
28techniques to produce the object code, which in the end might be
29more or less perfomant and more or less optimised, depending on
30several factors also related to the system architecture which it
31applies to.
32</para>
33
34<para>
35After the installation of the libraries, we strongly suggest to
36always distinguish between the installation directory (identified
37by $G4INSTALL) and the working directory (identified by
38$G4WORKDIR), in order not to alter the installation area.
39</para>
40
41<!-- ******************* Section (Level#2) ****************** -->
42<sect2 id="sect.TpPrgCmp.UnxLnxGpp">
43<title>
44Unix/Linux - g++
45</title>
46
47<para>
48OS: Linux
49</para>
50
51<para>
52Compiler: GNU/gcc
53</para>
54
55<para>
56Strict ISO/ANSI compilation is forced (<literal>-ansi -pedantic</literal>
57compiler flags), also code is compiled with high verbosity
58diagnostics (<literal>-Wall</literal> flag). The default optimisation level
59is <literal>-O2</literal>. The flag <literal>G4OPTDEBUG</literal>, if set
60in the environment, allows for optimised build of the libraries but
61including debug symbols (<literal>-O -g</literal> compilation option).
62</para>
63
64<note>
65<title>Note</title>
66
67<para>
68Additional compilation options (<literal>-march=XXX
69-mfpmath=sseYYY</literal>) to adopt chip specific floating-point
70operations on the SSE unit, can be activated by adapting the
71<literal>XXX, YYY</literal> options and uncommenting the relevant
72part in the <literal>Linux-g++.gmk</literal> configuration script.
73By doing so, it has been verified a greater stability of results,
74making possible reproducibility of exact outputs between debug,
75non-optimised and optimised runs. A little performance improvement
76(in the order of 2%) can also be achieved in some cases. To be
77considered that binaries built using these chip-specific options
78will likely NOT be portable cross platforms; generated applications
79will only run on the specific chip-based architectures.
80</para>
81</note>
82
83</sect2>
84
85
86<!-- ******************* Section (Level#2) ****************** -->
87<sect2 id="sect.TpPrgCmp.WndMsVslCpp">
88<title>
89Windows - MS Visual C++
90</title>
91
92<para>
93OS: MS/Windows
94</para>
95
96<para>
97Compiler: MS-VC++
98</para>
99
100<para>
101Since version .NET 7.0 of the compiler, ISO/ANSI compliance is
102required.
103</para>
104
105<para>
106See <xref linkend="sect.ClassCate" /> of the Installation Guide for
107more detailed information.
108See also <xref linkend="sect.BldMSV" /> for more tips.
109</para>
110
111</sect2>
112
113
114<!-- ******************* Section (Level#2) ****************** -->
115<sect2 id="sect.TpPrgCmp.McXCpp">
116<title>
117MacOS-X - g++
118</title>
119
120<para>
121OS: MacOS/Darwin
122</para>
123
124<para>
125Compiler: GNU/gcc
126</para>
127
128<para>
129The setup adopted for the <literal>g++</literal> compiler on MacOS
130resembles in most parts the one for Linux systems.
131</para>
132
133<para>
134The default optimisation level in this case is <literal>-O2</literal>.
135</para>
136
137<para>
138Dynamic libraries (<literal>.dylib</literal>) are supported as well; once
139built, in order to run the generated application, the user must
140specify the absolute path in the system where they're installed
141with the <literal>DYLD_LIBRARY_PATH</literal> system variable.
142</para>
143
144
145</sect2>
146</sect1>
Note: See TracBrowser for help on using the repository browser.