Skip to content

macOS build failure with libc++ 19#144

Merged
AndriiVoitenko merged 1 commit intomasterfrom
Fix-macOS-build
Apr 14, 2026
Merged

macOS build failure with libc++ 19#144
AndriiVoitenko merged 1 commit intomasterfrom
Fix-macOS-build

Conversation

@AndriiVoitenko
Copy link
Copy Markdown
Collaborator

libMVRgdtf fails to build on macOS with Homebrew LLVM 19:

error: implicit instantiation of undefined template 'std::char_traits'

On macOS, TXChar is UniChar (uint16_t), so StdUStr becomes std::basic_string<uint16_t>. libc++ 19 no longer provides std::char_traits for arbitrary types — only char, wchar_t, char8_t, char16_t, and char32_t.

Linux is already fine (TXChar = char16_t). The fix is to do the same on macOS in GSString.h:55:
// Before:
typedef UniChar TXChar;
// After:
typedef char16_t TXChar;

This is safe because:

  • The public API only exposes MvrString (const char*) — no type change visible to consumers
  • char16_t and uint16_t are the same width and representation
  • It actually fixes a latent UB in TXString::hash(), which already casts to std::u16string
  • CoreFoundation calls expecting UniChar* just need an explicit cast

 libMVRgdtf fails to build on macOS with Homebrew LLVM 19:
 error: implicit instantiation of undefined template 'std::char_traits<unsigned short>'
 On macOS, TXChar is UniChar (uint16_t), so StdUStr becomes std::basic_string<uint16_t>. libc++ 19 no longer provides std::char_traits for arbitrary types — only char, wchar_t, char8_t, char16_t, and char32_t.
 Linux is already fine (TXChar = char16_t). The fix is to do the same on macOS in GSString.h:55:
// Before:
 typedef UniChar TXChar;
// After:
 typedef char16_t TXChar;
 This is safe because:
 - The public API only exposes MvrString (const char*) — no type change visible to consumers
 - char16_t and uint16_t are the same width and representation
 - It actually fixes a latent UB in TXString::hash(), which already casts to std::u16string
 - CoreFoundation calls expecting UniChar* just need an explicit cast
@AndriiVoitenko AndriiVoitenko merged commit 45190a8 into master Apr 14, 2026
1 check passed
@AndriiVoitenko AndriiVoitenko deleted the Fix-macOS-build branch April 14, 2026 15:25
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.

3 participants