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