llvm / llvm/llvm-project

[libc][wctype] Linking error on Windows/MSVC (clang-cl) when `LIBC_CONF_WCTYPE_MODE=LIBC_WCTYPE_MODE_UTF8`

Open
#210,549 3 comments 0 reactions 0 assignees View on GitHub
libc platform:windows
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

LLVM 23.1.0-rc1, Ninja

```
54>lld-link : error : undefined symbol: unsigned short const *const __llvm_libc_23_1_0_rc1::LEVEL1
54> >>> referenced by D:/modding/nlc/engine/reaper-engine/3rd_party/Src/system/llvm/llvm-project/libc/src/wctype/iswspace.cpp
54> >>> llvmlibc.lib(iswspace.cpp.obj)
54>
54>lld-link : error : undefined symbol: unsigned char const *const __llvm_libc_23_1_0_rc1::LEVEL2
54> >>> referenced by D:/modding/nlc/engine/reaper-engine/3rd_party/Src/system/llvm/llvm-project/libc/src/wctype/iswspace.cpp
54> >>> llvmlibc.lib(iswspace.cpp.obj)
```

Those symbols are defined in `libc/src/__support/wctype/wctype_classification_utils.cpp` which doesn't get built. The corresponding directory for it in the build directory is created, but it's empty.

They are used by `isw*()` which are present in the entrypoints list for Windows.

Contributor guide

Open the contributing guide

Research direction

Start with libc/src/__support/wctype/wctype_classification_utils.cpp and the Windows entrypoints list for the isw*() functions. Compare the generated build-directory contents with the relevant build configuration to determine why this source is omitted when LIBC_CONF_WCTYPE_MODE=LIBC_WCTYPE_MODE_UTF8. Done means the source is built and the reported LEVEL1 and LEVEL2 linker errors no longer occur with clang-cl on Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.