Search code examples
unicodecygwinlibc

Cygwin: C standard library does not support <uchar.h>?


Scenario:

$ echo "#include <uchar.h>" | gcc -xc - -std=c11 -pedantic -Wall -Wextra
<stdin>:1:10: fatal error: uchar.h: No such file or directory
compilation terminated.

$ gcc --version
gcc (GCC) 11.2.0

$ uname -a
CYGWIN_NT-10.0 xxx 3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin

Does is mean that C standard library does not support <uchar.h>?


UPDATE. From Brian Inglis:

Nobody else has noticed or mentioned those in the last decade, so there may not be (any updates), as volunteers have limited time and their own interests and priorities.

Given that newlib is a freestanding implementation, and gcc does not provide that header, those definitions or declarations, these are considered platform implementation issues, which someone supporting that platform has to decide if they will provide and support.

ICU provides uchar.h which Cygwin libicu-devel maintainer installs under /usr/include/unicode/ with Unicode licence under /usr/share/icu//LICENSE. You could pull those two files from the ICU distro for use in your work.

It also is/will be available on glibc platforms which support it. Remember that GNU products are GPL licensed with possibly undesirable requirements for most commercial products.

Similarly, TIME_UTC may not be available on some newlib platforms/targets, so it will be up to platform and/or target maintainers to decide if they can support it, and provide implementations.

I don't know what your host platform is, your newlib target, or what POSIX time.h CLOCK_/clock_... support is available, but you may wish to use that instead, until someone can provide the ISO C equivalent in newlib under a BSD licence.

You may also wish to look at what is available in *BSD sources.


Solution

  • Install the libicu-devel package the header will be under:

    /usr/include/unicode/uchar.h