Skip to content

[nanvix] fix(z): disable libc++ wide characters (incomplete Nanvix libc)#35

Merged
ppenna merged 1 commit into
nanvix/v21.0.0from
bugfix-stage1-libcxx-wide-chars
Jun 30, 2026
Merged

[nanvix] fix(z): disable libc++ wide characters (incomplete Nanvix libc)#35
ppenna merged 1 commit into
nanvix/v21.0.0from
bugfix-stage1-libcxx-wide-chars

Conversation

@ppenna

@ppenna ppenna commented Jun 30, 2026

Copy link
Copy Markdown

Problem

The #34 merge cleared the libunwind header errors; the stage-1 build then failed compiling libc++/libc++abi:

build-runtimes/include/c++/v1/wchar.h:152: error: use of undeclared identifier 'wcspbrk'

libc++'s <wchar.h> wrapper (guarded by _LIBCPP_HAS_WIDE_CHARACTERS) defines const-correct overloads that call the C library's ::wcspbrk / ::wcschr / ::wcsrchr / ::wcsstr / ::wmemchr. The in-source Nanvix libc does not fully implement the wide-character API: wcspbrk is neither declared in <wchar.h> nor defined in libc.a (the others are). So libc++ can't be built with wide characters against this libc.

Fix

Set -DLIBCXX_ENABLE_WIDE_CHARACTERS=OFF. This guards out the entire wide-character wrapper class (not just wcspbrk), aligning libc++ with the libc's actual capabilities and avoiding further wide-char gaps in one step.

Chosen over injecting a wcspbrk declaration into the staged header, because the function is genuinely unimplemented in libc.a — declaring it would just defer to a link error. Reversible: re-enable once the Nanvix libc ships the full wide-character set (declarations + implementations).

Validation

  • bash -n z clean. wcspbrk confirmed absent from libc.a via llvm-nm; the wrapper block confirmed guarded by _LIBCPP_HAS_WIDE_CHARACTERS.

Caveat

Iterative stage-1 bring-up: this clears the wide-character blocker. Further libc++/libc++abi compile or link issues against the in-source libc may surface next; I'll continue iterating. Validated on merge (PR CI verifies stage 0 only).

The stage-1 build cleared libunwind and then failed building libc++/libc++abi:

  build-runtimes/include/c++/v1/wchar.h:152: error: use of undeclared identifier 'wcspbrk'

libc++'s <wchar.h> wrapper (guarded by _LIBCPP_HAS_WIDE_CHARACTERS) defines
const-correct overloads that call the C library's ::wcspbrk (and ::wcschr,
::wcsrchr, ::wcsstr, ::wmemchr). The in-source Nanvix libc does not fully
implement the wide-character API: wcspbrk is neither declared in <wchar.h>
nor defined in libc.a (the others are). So libc++ cannot be built with wide
characters against this libc.

Set LIBCXX_ENABLE_WIDE_CHARACTERS=OFF to match libc++ to the libc's actual
capabilities. This guards out the entire wide-character wrapper class (not
just wcspbrk), so it also avoids any further wide-char gaps in one step.
Reversible: re-enable once the Nanvix libc provides the full wide-character
set (declarations + implementations).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ppenna ppenna merged commit 559fd2e into nanvix/v21.0.0 Jun 30, 2026
1 check passed
@ppenna ppenna deleted the bugfix-stage1-libcxx-wide-chars branch June 30, 2026 02:10
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