Skip to content

0.9.2 --- a standard header compiles for every target, not only Linux - #17

Merged
Sunrisepeak merged 1 commit into
mainfrom
a-standard-header-on-every-target
Sep 13, 2026
Merged

0.9.2 --- a standard header compiles for every target, not only Linux#17
Sunrisepeak merged 1 commit into
mainfrom
a-standard-header-on-every-target

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

A consumer translation unit that includes a standard header did not compile for
the macOS or Windows target:

__locale_dir/support/linux.h:86:12: error: no member named 'strtof_l' in the global namespace
__locale_dir/support/linux.h:237:17: error: no member named 'vasprintf' in the global namespace

This configuration's locale support calls strtof_l, strtod_l, strtold_l
and vasprintf; musl declares them only under _GNU_SOURCE; and Clang
predefines _GNU_SOURCE for C++ on Linux targets and on no other. import std
never showed it, because the std module is compiled with this package's own
flags. Every module wrapper of a header library does show it, because the
wrapper includes the library's headers in its own translation unit. Found
building nlohmann.json from mcpp-index over this runtime for
x86_64-windows-gnu and aarch64-macos.

  • llvm-generated/generic/__config_site states _GNU_SOURCE. It is included by
    <__config> before any C header, including libc++'s wrappers of the C headers.
  • CI cross-builds examples/cxx (which includes <filesystem>) for both
    targets beside same-source. Measured locally: without the change both builds
    fail with the errors above; with it both succeed, and the Linux run of the
    example still reports failures: 0.
  • Version 0.9.2; README records the new line among the configuration's claims.

libc++'s musl locale support calls strtof_l, strtod_l, strtold_l and vasprintf,
which musl declares only under _GNU_SOURCE. Clang predefines _GNU_SOURCE for C++
on Linux targets only, so any consumer translation unit that includes a standard
header (every module wrapper of a header library does) failed for macOS and
Windows. __config_site now states _GNU_SOURCE, and CI cross-builds examples/cxx,
which includes <filesystem>, for both targets.
@Sunrisepeak
Sunrisepeak merged commit 414fb6f into main Sep 13, 2026
5 checks passed
@Sunrisepeak
Sunrisepeak deleted the a-standard-header-on-every-target branch September 13, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant