Chapter 2. Setup (original) (raw)
The 'gnu' locale model makes use of iconv
for character set conversions. The relevant functions are provided by Glibc and so are always available, however they can also be provided by the separate GNU libiconv library. If GNU libiconv is found when GCC is built (e.g., because its headers are installed in /usr/local/include
) then the libstdc++.so.6
library will have a run-time dependency on libiconv.so.2
. If you do not want that run-time dependency then you should do one of the following:
- Uninstall the libiconv headers before building GCC. Glibc already provides
iconv
so you should not need libiconv anyway. - Download the libiconv sources and extract them into the top level of the GCC source tree, e.g.,
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar xf libiconv-1.16.tar.gz
ln -s libiconv-1.16 libiconv
This will build libiconv as part of building GCC and link to it statically, so there is nolibiconv.so.2
dependency. - Configure GCC with
--with-libiconv-type=static
. This requires the staticlibiconv.a
library, which is not installed by default. You might need to reinstall libiconv using the--enable-static
configure option to get the static library.
If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt will be made to use "C" library functionality necessary for C++ named locale support, e.g. the newlocale
and uselocale
functions. For GCC 4.6.0 and later, this means that glibc 2.3 or later is required.
If the 'gnu' locale model is being used, the following locales are used and tested in the libstdc++ testsuites. The first column is the name of the locale, the second is the character set it is expected to use.
de_DE ISO-8859-1 de_DE@euro ISO-8859-15 en_GB ISO-8859-1 en_HK ISO-8859-1 en_PH ISO-8859-1 en_US ISO-8859-1 en_US.ISO-8859-1 ISO-8859-1 en_US.ISO-8859-15 ISO-8859-15 en_US.UTF-8 UTF-8 es_ES ISO-8859-1 es_MX ISO-8859-1 fr_FR ISO-8859-1 fr_FR@euro ISO-8859-15 is_IS UTF-8 it_IT ISO-8859-1 ja_JP.eucjp EUC-JP ru_RU.ISO-8859-5 ISO-8859-5 ru_RU.UTF-8 UTF-8 se_NO.UTF-8 UTF-8 ta_IN UTF-8 zh_TW BIG5
Failure to have installed the underlying "C" library locale information for any of the above regions means that the corresponding C++ named locale will not work: because of this, the libstdc++ testsuite will skip named locale tests which need missing information. If this isn't an issue, don't worry about it. If a named locale is needed, the underlying locale information must be installed. Note that rebuilding libstdc++ after "C" locales are installed is not necessary.
To install support for locales, do only one of the following:
- install all locales, e.g., run
dnf install glibc-all-langpacks
for Fedora and related distributions. - install just the necessary locales
- with Debian GNU/Linux:
Add the above list, as shown, to the file/etc/locale.gen
run/usr/sbin/locale-gen
- on most Unix-like operating systems:
localedef -i de_DE -f ISO-8859-1 de_DE
(repeat for each entry in the above list) - Instructions for other operating systems solicited.
- with Debian GNU/Linux:
Some tests for the std::messages
facet require a message catalog created by the msgfmt utility. That is usually installed as part of the GNU gettext library. If msgfmt is not available, some tests under the 22_locale/messages
directory will fail.