Bug 9336 - Improve iconv support for external toolchain based builds
Summary: Improve iconv support for external toolchain based builds
Status: RESOLVED WORKSFORME
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-06 15:56 UTC by Ilyas Gasanov
Modified: 2016-10-23 13:09 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilyas Gasanov 2016-10-06 15:56:35 UTC
Currently, when Linaro is selected as the build toolchain (and, quite possibly, with other external toolchains as well), only the very basic iconv support is available on target. Namely, the iconv utility from libc/usr/bin/iconv is not installed at all, nor are the contents of libc/usr/lib/<triplet>/gconv (which I presume to contain/implement conversion tables not baked in into libc binary).

If I manually copy the iconv utility onto the buildroot system, and then run the "iconv -l" command, I get the following list:

  10646-1:1993, 10646-1:1993/UCS4, ANSI_X3.4-1968, ANSI_X3.4-1986, ANSI_X3.4,
  ASCII, CP367, CSASCII, CSUCS4, IBM367, ISO-10646, ISO-10646/UCS2,
  ISO-10646/UCS4, ISO-10646/UTF-8, ISO-10646/UTF8, ISO-IR-6, ISO-IR-193,
  ISO646-US, ISO_646.IRV:1991, OSF00010020, OSF00010100, OSF00010101,
  OSF00010102, OSF00010104, OSF00010105, OSF00010106, OSF05010001, UCS-2,
  UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UCS2, UCS4, UNICODEBIG,
  UNICODELITTLE, US-ASCII, US, UTF-8, UTF8, WCHAR_T

Clearly this isn't sufficient for a good majority of tasks which involve character set conversions.

I'd like to see the iconv-related files copied, or possible to be copied via configuration parameters, in next releases of buildroot. Particularly I'm missing the capability to convert from CP1251 to UTF-8, but other charsets might be pretty useful too.
Comment 1 Thomas Petazzoni 2016-10-23 13:09:52 UTC
There is already a Buildroot option to copy gconv modules to the target, it just seems you missed it. In the toolchain menu, when a glibc toolchain is used, you have:

  [*] Copy gconv libraries
  ()    Gconv libraries to copy

If you leave the second option empty, all gconv modules are copied to the target. Otherwise, if it's non-empty, only the specified list of gconv modules are copied.

I've just tested again today, leaving the list empty. Indeed, all gconv modules are copied, and a simple C program that converts an UTF-8 string to CP1251 using iconv_open() / iconv() works just fine on the target.

The iconv binary itself is however indeed not copied. Maybe we should add an option to copy additional binaries from the toolchain to the target? Could you submit such a patch?