Configure
When configuring libstdc++, you'll have to configure the entire gccsrcdir directory. Consider using the toplevel gcc configuration option--enable-languages=c++
, which saves time by only building the C++ toolchain.
只编译c++的话使用--enable-languages=c++,都支持的话使用--enable-languages=c,c++,前者节省时间。
Here are all of the configure options specific to libstdc++. Keep in mind that
这里有全部的configure选项,针对libstdc++。
they all have opposite forms as well (enable/disable and with/without). The defaults are for thecurrent development sources, which may be different than those for released versions.选项都有相反的(enable/disable and with/without)
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:./configure --help.
./configure --help是典型的查看选项的方法
-
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.
-
这是部分的通用multilib支持构建交叉编译器,不同的libstdc++将建为每个不同的multilib版本。默认选项。
-
Forces old, set-jump/long-jump exception handling model. If at all possible, the new, frame unwinding exception handling routines should be used instead, as they significantly reduce both runtime memory usage and executable size. This option can change the library ABI.
-
强制用旧的set-jump/long-jump异常处理模块(C语言的)。如果可能的话,应该使用新的框架解除异常处理例程,因为他们大大减少运行时内存使用量和可执行的大小。
-
Specify that run-time libraries should be installed in the compiler-specific subdirectory (i.e.,
${libdir}/gcc-lib/${target_alias}/${gcc_version}
) instead of${libdir}
. 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${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++
, unless you also specify--with-gxx-include-dir=
dirname
during configuration. -
指定运行时库应该安装在编译器特定的子目录中,也就是${libdir}/gcc-lib/${target_alias}/${gcc_version}代替${libdir}。这个选项是有用的,如果你打算使用多个版本的gcc。
-
另外,libstdc++的包含文件将安装在${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++,除非你指定--with-gxx-include-dir=目录名。
-
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)".
-
可以支持命名libstdc++包含目录。例如:……。
--with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/4.4-20090404
-
This is an abbreviated form of
'--enable-cstdio=stdio'
(described next). -
这是--enable-cstdio=stdio的缩写
-
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.
-
This is an abbreviated form of
'--enable-clocale=generic'
(described next). -
这是--enable-clocale=generic的缩写
-
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 glibc, the GNU C library), or 'generic' to use a generic "C" abstraction which consists of "C" locale info.
-
选择一个有针对性的底层本地包。选择是‘ieee_1003.1-2001’指定一个X/Open标准Unix (IEEE Std. 1003.1-2001)模型基于langinfo/iconv/catgets,‘gnu’指定一个基于GNU C库(langinfo/iconv/gettext)(来自glibc, the GNU C library),或'generic'使用一个通用的由“C”语言环境信息的“C”抽象。
If not explicitly specified, the configure proccess 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. This option can change the library ABI.
-
configure默认猜测最适合的选择,默认是'generic'。基于glibc系统,很古董。。自动选择‘gnu’。这个选项能改变应用程序二进制接口。
-
This is an abbreviated form of
'--enable-libstdcxx-allocator=auto'
(described next). -
这是--enable-libstdcxx-allocator=auto的缩写。
-
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 extensions. This option can change the library ABI.
-
选择一个有针对性的底层std::allocator。选择‘new’指定新封装,‘malloc’指定malloc封装。‘mt’确定的强大的两个alloctor,‘pool’SGI的池allocator,‘bitmap’一个位图
-
allocator。查看allocator更多信息extensions。这个选项改变应用程序二进制接口。
-
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'.
-
这允许用户定义的方法被用于C++兼容C的头文件。选项是c, c_std, 和c_global。和源码的include/c, include/c_std, include/c_global一致,通常也包含include/c_compatibility
-
。默认是c_global。
-
This is an abbreviated form of
'--enable-threads=yes'
(described next). -
这是--enable-threads=yes缩写。
-
Select a threading library. A full description is given in the general compiler configuration instructions. This option can change the library ABI.
-
选择一个线程库。全部的描述在compiler configuration instructions。这个选项改变库的应用程序二进制接口。
-
This is an abbreviated form of
'--enable-libstdcxx-time=yes'
(described next). -
这是--enable-libstdcxx-time=yes的缩写。
-
Enables link-type checks for the availability of the clock_gettime clocks, used in the implementation of [time.clock], and of the nanosleep and sched_yield 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 of need the latter is also linked to libstdc++ as part of the build process. OPTION=rt also searches (and, in case, links) librt. Note that the latter is not always desirable because, in glibc, for example, in turn it triggers the linking of libpthread too, which activates locking, a large overhead for single-thread programs. OPTION=no skips the tests completely. The default is OPTION=no.
-
选项:yes或no或rt。yes优先测试开启C++2011标准的time.clock实现所使用的 clock_gettime时钟,优先使用libposix4部分链接到 libstdc++。默认是no,取消测试。
-
rt通常搜索librt,链接glibc和pthread,将激活锁和导致单线程程序的巨大开销。
-
Build separate debug libraries in addition to what is normally built. By default, the debug libraries are compiled with
CXXFLAGS='-g3 -O0 -fno-inline'
, are installed in${libdir}/debug
, and have the same names and versioning information as the non-debug libraries. This option is off by default. -
额外构建独立的debug库。它的编译标志使用
CXXFLAGS='-g3 -O0 -fno-inline',将安装在${libdir}/debug下面,和非debug库有一样的名字和版本信息。默认是关闭。
Note this make command, executed in the build directory, will do much the same thing, without the configuration difference and without building everything twice:
make CXXFLAGS='-g3 -O0 -fno-inline' all
-
This option is only valid when
--enable-debug
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 -
--enable-debug设定时,这个选项才有效,仅适用于debug构建。当编译debug版libstdc++使你可以传递特定字符串标志给编译器。FLAGS使用单引号引用字符串。如:
--enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'
-
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
-
此选项使你在构建libstdc++时传递一个字符串 -f(功能性标志) 给编译器使用。这个选项能改变应用程序二进制接口。FLAGS使用单引号引用字符串。如:
--enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'
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.
-
注意此标志不需要所有的都加-f标志。但他们通常是有意义的实验和配置时的重新定义。(就是-f的一般将重写配置标志)
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.
-
--enable-cxx-flags比在'make'环境设置CXXFLAGS的优势是:如果文件自动重新构建,同样的标志将会在编译时使用,以使所有都匹配。
Fun flags to try might include combinations of 值得尝试的组合是
-fstrict-aliasing -fno-exceptions -ffunction-sections -fvtable-gc
and opposite forms (-fno-) of the same. Tell us (the libstdc++ mailing list) if you discover more!
-
相反的形式是-fno-
-
The "long long" 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
namespace __gnu_cxx
, 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. -
启用c99标准。。。。待续
-
Template specializations for the "wchar_t" 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.
-
启用wchar_t。。。默认
-
The "long long" 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., <cmath> not <math.h>) 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.
-
开启longlong。。默认
-
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.
-
开启特殊版本basic_string避免优化在静态内存分配空对象。。通常和共享内存allocator一样有用。详见PR libstdc++/16612。
-
This turns on additional compile-time checks for instantiated library templates, in the form of specialized templates,described here. They can help users discover when they break the rules of the STL, before their programs run.
-
开启编译时检查实例化的库模板。详见described here。可在程序运行前发现是否不符合STL规则。
-
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.
-
3.1和以后的版本,尝试打开共享库的符号版本。支持'gnu', 'gnu-versioned-namespace', 'darwin', 'darwin-export', 'sun'。如果未指定则猜测系统,看是否可激活版本信息。
-
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
visibility ("default")
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--enable-visibility
. -
4.2和以后的版本,开启或关闭可见属性。默认开启。可以使用- fvisibility选项而不影响正常的外部std名称空间实体可见性。4.7以前,写法是--enable-visibility
-
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
--include bits/stdc++.h
to CXXFLAGS) when running the testsuite. -
3.4和以后版本,尝试打开stdc++.h.gch的建立,标准C++头文件的预编译头文件。默认开启。另外,这个文件将在运行测试集时使用(追加--include bits/stdc++.h 给CXXFLAGS)
-
Use extern template to pre-instantiate all required specializations for certain types defined in the standard libraries. These types include
string
and dependents likechar_traits
, the templateized io classes,allocator
, 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. -
对于某些类型定义在标准库使用外来的模板实例化之前所有必需的专门化。这些类型包含string char_traits 类模板 allocator 其他。
-
关闭意味着编译那些类型时隐式模板建立将被使用。
-
By default, a complete hosted C++ library is built. The C++ Standard also describes afreestanding environment, in which only a minimal set of headers are provided. This option builds such an environment.
-
默认建立一个完整的托管c++库。独立的环境,仅提供最小限度的头文件。
--enable-multilib
[default]
--enable-sjlj-exceptions
--enable-version-specific-runtime-libs
--with-gxx-include-dir=<include-files dir>
--enable-cstdio
--enable-cstdio=OPTION
选择一个有针对性的I/O包。目前,唯一的选择是使用“stdio”,一个通用的“C”的抽象。默认的是“stdio”。这个选项可以改变库应用程序二进制接口。
--enable-clocale
--enable-clocale=OPTION
--enable-libstdcxx-allocator
--enable-libstdcxx-allocator=OPTION
--enable-cheaders=OPTION
--enable-threads
--enable-threads=OPTION
--enable-libstdcxx-time
--enable-libstdcxx-time=OPTION
--enable-libstdcxx-debug
--enable-libstdcxx-debug-flags=FLAGS
--enable-cxx-flags=FLAGS
--enable-c99
--enable-wchar_t
[default]
--enable-long-long
--enable-fully-dynamic-string
--enable-concept-checks
--enable-symvers[=style]
--enable-libstdcxx-visibility
--enable-libstdcxx-pch
--enable-extern-template
[default]
--disable-hosted-libstdcxx