Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<section xmlns="http://docbook.org/ns/docbook" version="5.0" 
	 xml:id="manual.intro.setup.configure" xreflabel="Configuring">
<?dbhtml filename="configure.html"?>

<info><title>Configure</title>
  <keywordset>
    <keyword>ISO C++</keyword>
    <keyword>configure</keyword>
    <keyword>options</keyword>
  </keywordset>
</info>



<para>
  When configuring libstdc++, you'll have to configure the entire
  <emphasis>gccsrcdir</emphasis> directory. Consider using the
  toplevel gcc configuration option
  <literal>--enable-languages=c++</literal>, which saves time by only
  building the C++ toolchain.
</para>

<para>
  Here are all of the configure options specific to libstdc++.  Keep
  in mind that
   <!-- This SECnn should be the "Choosing Package Options" section. -->
   <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://sourceware.org/autobook/autobook/autobook_14.html">they
   all have opposite forms as well</link> (enable/disable and
   with/without).  The defaults are for the <emphasis>current
   development sources</emphasis>, which may be different than those
   for released versions.
</para>
<para>The canonical way to find out the configure options that are
   available for a given set of libstdc++ sources is to go to the
   source directory and then type: <command>./configure --help</command>.
</para>

<variablelist>
 <varlistentry><term><code>--enable-multilib</code>[default]</term>
 <listitem><para>This is part of the generic multilib support for building cross
	compilers.  As such, targets like "powerpc-elf" will have
	libstdc++ built many different ways:  "-msoft-float"
	and not, etc.  A different libstdc++ will be built for each of
	the different multilib versions.  This option is on by default.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-version-specific-runtime-libs</code></term>
 <listitem><para>Specify that run-time libraries should be installed in the
	compiler-specific subdirectory (i.e.,
	<code>${libdir}/gcc-lib/${target_alias}/${gcc_version}</code>)
	instead of <code>${libdir}</code>.  This option is useful if you
	intend to use several versions of gcc in parallel.  In addition,
	libstdc++'s include files will be installed in
	<code>${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++</code>,
	unless you also specify
       <literal>--with-gxx-include-dir=</literal><filename class="directory">dirname</filename> during configuration.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--with-gxx-include-dir=&lt;include-files dir&gt;</code></term>
 <listitem><para>Adds support for named libstdc++ include directory.  For instance,
	the following puts all the libstdc++ headers into a directory
	called "4.4-20090404" instead of the usual
	"c++/(version)".
     </para>
	<programlisting>
   --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/4.4-20090404</programlisting> </listitem></varlistentry>

 <varlistentry><term><code>--enable-cstdio</code></term>
 <listitem><para>This is an abbreviated form of <code>'--enable-cstdio=stdio'</code>
	(described next).
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-cstdio=OPTION</code></term>
 <listitem><para>Select a target-specific I/O package. At the moment, the only
	choice is to use 'stdio', a generic "C" abstraction.
	The default is 'stdio'. This option can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-clocale</code></term>
 <listitem><para>This is an abbreviated form of <code>'--enable-clocale=generic'</code>
	(described next).
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-clocale=OPTION</code></term>
 <listitem><para>Select a target-specific underlying locale package.  The
	choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix
	(IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets,
	'gnu' to specify a model based on functionality from the GNU C
	library (langinfo/iconv/gettext) (from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.gnu.org/software/libc/">glibc</link>, the GNU C
	library), 'generic' to use a generic "C" abstraction which consists
	of "C" locale info, 'newlib' to specify the Newlib C library model
	which only differs from the 'generic' model in the handling of
	ctype, or 'darwin' which omits the <type>wchar_t</type> specializations
	needed by the 'generic' model.
     </para>

     <para>If not explicitly specified, the configure process tries
      to guess the most suitable package from the choices above. The
      default is 'generic'. On glibc-based systems of sufficient
      vintage (2.3 and newer), 'gnu' is automatically selected. On newlib-based
      systems (<code>'--with_newlib=yes'</code>) and OpenBSD, 'newlib' is
      automatically selected. On Mac OS X 'darwin' is automatically selected.
      This option can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-allocator</code></term>
 <listitem><para>This is an abbreviated form of
	<code>'--enable-libstdcxx-allocator=auto'</code> (described
	next).
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-allocator=OPTION  </code></term>
 <listitem><para>Select a target-specific underlying std::allocator.  The
	choices are 'new' to specify a wrapper for new, 'malloc' to
	specify a wrapper for malloc, 'mt' for a fixed power of two allocator,
	'pool' for the SGI pooled allocator or 'bitmap' for a bitmap allocator.
	See this page for more information on allocator
	<link linkend="allocator.ext">extensions</link>. This option
	can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-cheaders=OPTION</code></term>
 <listitem><para>This allows the user to define the approach taken for C header
	compatibility with C++. Options are c, c_std, and c_global.
	These correspond to the source directory's include/c,
	include/c_std, and include/c_global, and may also include
	include/c_compatibility.  The default is 'c_global'.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-threads</code></term>
 <listitem><para>This is an abbreviated form of <code>'--enable-threads=yes'</code>
	(described next).
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-threads=OPTION</code></term>
 <listitem><para>Select a threading library.  A full description is
	given in the
	general <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/install/configure.html">compiler
	configuration instructions</link>. This option can change the
	library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-threads</code></term>
 <listitem><para>Enable C++11 threads support.  If not explicitly specified,
        the  configure process enables it if possible.  This
	option can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-time</code></term>
 <listitem><para>This is an abbreviated form of
	<code>'--enable-libstdcxx-time=yes'</code>(described next).
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
 <listitem><para>Enables link-type checks for the availability of the
	<function>clock_gettime</function> clocks, used in the implementation
	of [time.clock], and of the <function>nanosleep</function> and
	<function>sched_yield</function> functions, used in the
	implementation of [thread.thread.this] of the 2011 ISO C++ standard.
	The choice OPTION=yes checks for the availability of the facilities
	in libc and libposix4.  In case it's needed the latter is also linked
	to libstdc++ as part of the build process.  OPTION=rt also checks in
	librt (and, if it's needed, links to it).  Note that linking to librt
	is not always desirable because for glibc it requires linking to
	libpthread too, which causes all reference counting to use atomic
	operations, resulting in a potentially large overhead for
	single-threaded programs.  OPTION=no skips the tests completely.
	The default is OPTION=auto, which skips the checks and enables the
	features only for targets known to support them.
	For Linux targets, if <function>clock_gettime</function> is not used
	then the [time.clock] implementation will use a system call to access
	the realtime and monotonic clocks, which is significantly slower than
	the C library's <function>clock_gettime</function> function.
    </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-debug</code></term>
 <listitem><para>Build separate debug libraries in addition to what is normally built.
	By default, the debug libraries are compiled with
	<code> CXXFLAGS='-g3 -O0 -fno-inline'</code>
	, are installed in <code>${libdir}/debug</code>, and have the
	same names and versioning information as the non-debug
	libraries. This option is off by default.
     </para>
     <para>Note this make command, executed in
	the build directory, will do much the same thing, without the
	configuration difference and without building everything twice:
	<code>make CXXFLAGS='-g3 -O0 -fno-inline' all</code>
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-debug-flags=FLAGS</code></term>

 <listitem><para>This option is only valid when
	<code>--enable-libstdcxx-debug</code>
	is also specified, and applies to the debug builds only. With
	this option, you can pass a specific string of flags to the
	compiler to use when building the debug versions of libstdc++.
	FLAGS is a quoted string of options, like
     </para>
	<programlisting>
  --enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'</programlisting>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-cxx-flags=FLAGS</code></term>
 <listitem><para>With this option, you can pass a string of -f (functionality)
	flags to the compiler to use when building libstdc++. This
	option can change the library ABI. FLAGS is a quoted string of
	options, like
     </para>
	<programlisting>
  --enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</programlisting>
     <para>
	Note that the flags don't necessarily have to all be -f flags,
	as shown, but usually those are the ones that will make sense
	for experimentation and configure-time overriding.
     </para>
     <para>The advantage of --enable-cxx-flags over setting CXXFLAGS in
	the 'make' environment is that, if files are automatically
	rebuilt, the same flags will be used when compiling those files
	as well, so that everything matches.
     </para>
     <para>Fun flags to try might include combinations of
     </para>
	<programlisting>
  -fstrict-aliasing
  -fno-exceptions
  -ffunction-sections
  -fvtable-gc</programlisting>
     <para>and opposite forms (-fno-) of the same.  Tell us (the libstdc++
	mailing list) if you discover more!
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-c99</code></term>
 <listitem><para>The <type>long long</type> type was introduced in C99, along
	with many other functions for wide characters, and math
	classification macros, etc.  If enabled, all C99 functions not
	specified by the C++ standard will be put into <code>namespace
	__gnu_cxx</code>, and then all these names will
	be injected into namespace std, so that C99 functions can be
	used "as if" they were in the C++ standard (as they
	will eventually be in some future revision of the standard,
	without a doubt).  By default, C99 support is on, assuming the
	configure probes find all the necessary functions and bits
	necessary. This option can change the library ABI.
    </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-wchar_t</code>[default]</term>
 <listitem><para>Template specializations for the <type>wchar_t</type> type are
	required for wide character conversion support.  Disabling
	wide character specializations may be expedient for initial
	porting efforts, but builds only a subset of what is required by
	ISO, and is not recommended.  By default, this option is on.
	This option can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-long-long  </code></term>
 <listitem><para>The <type>long long</type> type was introduced in C99.  It is
	provided as a GNU extension to C++98 in g++.  This flag builds
	support for "long long" into the library (specialized
	templates and the like for iostreams).  This option is on by default:
	if enabled, users will have to either use the new-style "C"
	headers by default (i.e., &lt;cmath&gt; not &lt;math.h&gt;)
	or add appropriate compile-time flags to all compile lines to
	allow "C" visibility of this feature (on GNU/Linux,
	the flag is -D_ISOC99_SOURCE, which is added automatically via
	CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE).
	This option can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-fully-dynamic-string</code></term>
 <listitem><para>This option enables a special version of basic_string avoiding
	the optimization that allocates empty objects in static memory.
	Mostly useful together with shared memory allocators, see PR
	libstdc++/16612 for details.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-concept-checks</code></term>
 <listitem><para>This turns on additional compile-time checks for instantiated
	library templates, in the form of specialized templates described in
        the <link linkend="std.diagnostics.concept_checking">Concept
        Checking</link> section.  They
	can help users discover when they break the rules of the STL, before
	their programs run. These checks are based on C++03 rules and some of
	them are not compatible with correct C++11 code.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-symvers[=style]</code></term>

 <listitem><para>In 3.1 and later, tries to turn on symbol versioning in the
	shared library (if a shared library has been
	requested). Values for 'style' that are currently supported
	are 'gnu', 'gnu-versioned-namespace', 'darwin',
	'darwin-export', and 'sun'. Both gnu- options require that a recent
	version of the GNU linker be in use. Both darwin options are
	equivalent. With no style given, the configure script will try
	to guess correct defaults for the host system, probe to see if
	additional requirements are necessary and present for
	activation, and if so, will turn symbol versioning on. This
	option can change the library ABI.
     </para>

 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-visibility</code></term>
 <listitem><para> In 4.2 and later, enables or disables visibility 
        attributes. If enabled (as by default), and the compiler seems
        capable of passing the simple sanity checks thrown at it, adjusts
        items in namespace std, namespace std::tr1, namespace std::tr2,
        and namespace __gnu_cxx to have <code>visibility ("default")</code>
        so that -fvisibility options can be used without affecting the
        normal external-visibility of namespace std entities.
        Prior to 4.7 this option was spelled <code>--enable-visibility</code>.
    </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-pch</code></term>
 <listitem><para>In 3.4 and later, tries to turn on the generation of
	stdc++.h.gch, a pre-compiled file including all the standard
	C++ includes. If enabled (as by default), and the compiler
	seems capable of passing the simple sanity checks thrown at
	it, try to build stdc++.h.gch as part of the make process.
	In addition, this generated file is used later on (by appending <code>
	--include bits/stdc++.h </code> to CXXFLAGS) when running the
	testsuite.
     </para>
 </listitem></varlistentry>


 <varlistentry><term><code>--enable-extern-template</code>[default]</term>
 <listitem><para>Use extern template to pre-instantiate all required
 	specializations for certain types defined in the standard libraries. 
	These types include <classname>string</classname> and dependents like
	<classname>char_traits</classname>, the templatized IO classes,
	<classname>allocator</classname>, and others.  
	Disabling means that implicit
	template generation will be used when compiling these types.  By
	default, this option is on. This option can change the library ABI.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--disable-hosted-libstdcxx</code></term>
 <listitem>
   <para>
     By default, a complete <emphasis>hosted</emphasis> C++ library is
     built.  The C++ Standard also describes a
     <emphasis>freestanding</emphasis> environment, in which only a
     minimal set of headers are provided.  This option builds such an
     environment.
     </para>
 </listitem></varlistentry>

<varlistentry><term><code>--disable-libstdcxx-verbose</code></term>
 <listitem>
   <para>
     By default, the library is configured to write descriptive messages
     to standard error for certain events such as calling a pure virtual
     function or the invocation of the standard terminate handler.  Those
     messages cause the library to depend on the demangler and standard I/O
     facilities, which might be undesirable in a low-memory environment or
     when standard error is not available.  This option disables those
     messages.  This option does not change the library ABI.
   </para>
 </listitem></varlistentry>

<varlistentry><term><code>--disable-libstdcxx-dual-abi</code></term>
 <listitem>
   <para>
     Disable support for the new, C++11-conforming implementations of
     <code>std::string</code>, <code>std::list</code> etc. so that the
     library only provides definitions of types using the old ABI
     (see <xref linkend="manual.intro.using.abi"/>).
     This option changes the library ABI.
   </para>
 </listitem></varlistentry>

<varlistentry><term><code>--with-default-libstdcxx-abi=</code><replaceable>OPTION</replaceable></term>
 <listitem>
   <para>
     Set the default value for the <symbol>_GLIBCXX_USE_CXX11_ABI</symbol>
     macro (see <xref linkend="manual.intro.using.macros"/>).
     The default is <option>OPTION=new</option> which sets the macro to
     <literal>1</literal>,
     use <option>OPTION=gcc4-compatible</option> to set it to
     <literal>0</literal>.
     This option does not change the library ABI.
   </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--with-libstdcxx-lock-policy=OPTION</code></term>
 <listitem><para>Sets the lock policy that controls how
        <classname>shared_ptr</classname> reference counting is
        synchronized.
        The choice OPTION=atomic enables use of atomics for updates to
        <classname>shared_ptr</classname> reference counts.
        The choice OPTION=mutex enables use of a mutex to synchronize updates
        to <classname>shared_ptr</classname> reference counts.
        If the compiler's thread model is "single" then this option has no
        effect, as no synchronization is used for the reference counts.
	The default is OPTION=auto, which checks for the availability of
        compiler built-ins for 2-byte and 4-byte atomic compare-and-swap,
        and uses OPTION=atomic if they're available, OPTION=mutex otherwise.
        This option can change the library ABI.
        If the library is configured to use atomics and user programs are
        compiled using a target that doesn't natively support the atomic
        operations (e.g. the library is configured for armv7 and then code
        is compiled with <option>-march=armv5t</option>) then the program
        might rely on support in libgcc to provide the atomics.
    </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-vtable-verify</code>[default]</term>
 <listitem>
    <para>Use <code>-fvtable-verify=std</code> to compile the C++
    runtime with instrumentation for vtable verification. All virtual
    functions in the standard library will be verified at runtime.
    Types impacted include <classname>locale</classname> and
    <classname>iostream</classname>, and others.  Disabling means that
    the C++ runtime is compiled without support for vtable
    verification. By default, this option is off.
     </para>
 </listitem></varlistentry>

 <varlistentry><term><code>--enable-libstdcxx-filesystem-ts</code>[default]</term>
 <listitem>
    <para>Build <filename class="libraryfile">libstdc++fs.a</filename> as well
      as the usual libstdc++ and libsupc++ libraries. This is enabled by
      default on select POSIX targets where it is known to work and disabled
      otherwise.
    </para>
 </listitem></varlistentry>

</variablelist>

</section>