vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.52k stars 2.15k forks source link

v does not support Chinese character path name under Windows 10 #21502

Open kbkpbot opened 1 month ago

kbkpbot commented 1 month ago

Describe the bug

v does not support Chinese character path name under Windows 10, it will fail when compile v program.

Reproduction Steps

create any v file, such as

module main
fn main() {
    println('hello,world')
}

Place this hello.v into a directory, which contain Chinese character, such as

D:\v\测试\hello.v

Then compile it,

v -o hello hello.v

It will fail to compile the hello.v

Expected Behavior

compile and run without error

Current Behavior

D:\v\测试>v -o hello hello.v
==================
C:/Users/DDT/AppData/Local/Temp/v_0/hello.01HXXJ9FKJCDVCS554MPZP4VFA.tmp.c:6903: warning: implicit declaration of function 'tcc_backtrace'
tcc: error: could not create 'D:\v\测试\hello.def': No such file or directory
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .

Possible Solution

No response

Additional Information/Context

compile with msvc , will fail also.

D:\v\测试>v -o hello hello.v -cc msvc
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.39.33523 版
版权所有(C) Microsoft Corporation。保留所有权利。

cl -w /we4013 /volatile:ms /Fo"C:\Users\DDT\AppData\Local\Temp\v_0\hello.01HXXJEEA7Q46BZ5FYGC4T1HAG.tmp.c.obj" /F 16777216 /MD /DNDEBUG "C:\Users\DDT\AppData\Local\Temp\v_0\hello.01HXXJEEA7Q46BZ5FYGC4T1HAG.tmp.c" -I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt" -I "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include" -I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um" -I "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared" kernel32.lib user32.lib advapi32.lib ws2_32.lib dbghelp.lib /link /NOLOGO /OUT:"D:\v\娴嬭瘯\hello.exe" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\X64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\X64" /LIBPATH:"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\X64" /DEBUG:FULL

hello.01HXXJEEA7Q46BZ5FYGC4T1HAG.tmp.c
LINK : fatal error LNK1104: 无法打开文件“D:\v\娴嬭瘯\hello.exe”

builder error: msvc error

V version

V full version: V 0.4.5 58a8fc6

Environment details (OS name and version, etc.)

D:\v\测试>v doctor V full version: V 0.4.5 58a8fc6 OS: windows, Microsoft Windows 10 ҵ LTSC v19044 64 λ Processor: 16 cpus, 64bit, little endian,

getwd: D:\v\测试 vexe: D:\v\v\v\v.exe vexe mtime: 2024-05-14 02:15:32

vroot: OK, value: D:\v\v\v VMODULES: OK, value: C:\Users\DDT.vmodules VTMP: OK, value: C:\Users\DDT\AppData\Local\Temp\v_0

Git version: git version 2.43.0.windows.1 Git vroot status: weekly.2024.20-dirty .git/config present: true

CC version: Error: 'cc' is not recognized as an internal or external command, operable program or batch file.

thirdparty/tcc status: thirdparty-windows-amd64 b99a453d

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

kbkpbot commented 1 month ago

Under Ubuntu, has no this bug

spytheman commented 1 month ago

It is a known problem affecting V through tcc.

Try using gcc or clang with -cc gcc as a workaround, or move the project to a folder that has only latin letters + numbers in its path on windows.

spytheman commented 1 month ago

hm, msvc should have worked though 🤔 ... I'll have to check again.