Issue 64668
Summary Failed to compile llvm on a windows machine with Chinese Language #build-problem
Labels new issue
Assignees
Reporter RichardUSTC
    Hello,
I was compiling llvm on a Windows machine with Visual Studio. The system language is Simplified Chinese and thus the default code page is 936. 

During the compiling process, I encountered some warning and error messages as follows:
```
clang\lib\Lex\UnicodeCharSets.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失 (编译源文件 clang\lib\Lex\Lexer.cpp) [tools\clang\lib\Lex\obj.clangLex.vcxproj]
  RewriteRule.cpp
  ChromiumCheckModel.cpp
clang\lib\Lex\UnicodeCharSets.h(394,1): error C2226: 语法错误: 意外的“llvm::sys::UnicodeCharRange”类型 (编译源文件 clang\lib\Lex\Lexer.cpp) [tools\clang\lib\Lex\obj.clangLex.vcxproj]
clang\lib\Lex\UnicodeCharSets.h(394,69): error C2143: 语法错误: 缺少“;”(在“{”的前面) (编译源文件 clang\lib\Lex\Lexer.cpp) [tools\clang\lib\Lex\obj.clangLex.vcxproj]
  SourceCode.cpp
clang\lib\Lex\UnicodeCharSets.h(394,69): error C2447: “{”: 缺少函数标题(是否是老式的形式表?) (编译源文件 clang\lib\Lex\Lexer.cpp) [tools\clang\lib\Lex\obj.clangLex.vcxproj]
```

In a word, the compiler was complaining that the source file cannot represent some unicode charaters in code page 936.

I finally fixed the problem by adding `-DCMAKE_C_FLAGS="/utf-8" -DCMAKE_CXX_FLAGS="/utf-8"` to the cmake command line.
I hope that you can add the '/utf-8' flags directly in the CMakeLists.txt by default.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to