cc-rs
cc-rs copied to clipboard
On windows cmd.exe, cargo build cal msvc cl, the output encoding are invalid.
cc = "1.0.61"
= note: `#[warn(deprecated)]` on by default
warning: 1 warning emitted
Compiling relibc v0.1.0 (C:\work\study\os\redox\relibc)
The following warnings were emitted during compilation:
warning: cl: ������ error D8021 :��Ч����ֵ������/Wno-expansion-to-defined��
error: failed to run custom build command for `relibc v0.1.0 (C:\work\study\os\redox\relibc)`
Caused by:
process didn't exit successfully: `C:\work\study\os\redox\relibc\target\debug\build\relibc-df312d9f2100ce01\build-script-build` (exit code: 1)
--- stderr
error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "C:\\work\\study\\os\\redox\\relibc/include" "-W4" "-nostdinc" "-nostdlib" "-fno-stack-protector" "-Wno-expansion-to-defined" "-FoC:\\work\\study\\os\\redox\\relibc\\target\\debug\\build\\relibc-7204dd44fe4e99e1\\out\\src/c\\dlmalloc.o" "-c" "src/c\\dlmalloc.c" with args "cl.exe" did not execute successfully (status code exit code: 2).
Can you try setting VSLANG=1033
in the environment? If that works then we can try doing the same thing that rustc does
Can you try setting
VSLANG=1033
in the environment? If that works then we can try doing the same thing that rustc does
I am sorry that the newest version of visual studio doesn't take care of VSLANG=1033
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>set VSLANG=1033
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>set LC_ALL=c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>link
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation. All rights reserved.
用法: LINK [选项] [文件] [@commandfile]
选项:
/ALIGN:#
/ALLOWBIND[:NO]
/ALLOWISOLATION[:NO]
/APPCONTAINER[:NO]
/ASSEMBLYDEBUG[:DISABLE]
/ASSEMBLYLINKRESOURCE:文件名
/ASSEMBLYMODULE:文件名
/ASSEMBLYRESOURCE:文件名[,[名称][,PRIVATE]]
/BASE:{地址[,大小]|@文件名,键}
/CLRIMAGETYPE:{IJW|PURE|SAFE|SAFE32BITPREFERRED}
/CLRLOADEROPTIMIZATION:{MD|MDH|NONE|SD}
/CLRSUPPORTLASTERROR[:{NO|SYSTEMDLL}]
/CLRTHREADATTRIBUTE:{MTA|NONE|STA}
/CLRUNMANAGEDCODECHECK[:NO]
/DEBUG[:{FASTLINK|FULL|NONE}]
/DEF:文件名
/DEFAULTLIB:库
/DELAY:{NOBIND|UNLOAD}
/DELAYLOAD:dll
/DELAYSIGN[:NO]
/DEPENDENTLOADFLAG:flag
/DLL
/DRIVER[:{UPONLY|WDM}]
/DYNAMICBASE[:NO]
/ENTRY:symbol
(按回车键继续)
/ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
/EXPORT:symbol
/EXPORTPADMIN[:size]
/FASTFAIL[:NO]
/FASTGENPROFILE[:{COUNTER32|COUNTER64|EXACT|MEMMAX=#|MEMMIN=#|NOEXACT|
NOPATH|NOTRACKEH|PATH|PGD=filename|TRACKEH}]
/FILEALIGN:#
/FIXED[:NO]
/FORCE[:{MULTIPLE|UNRESOLVED}]
/FUNCTIONPADMIN[:大小]
/GUARD:{CF|NO}
/GENPROFILE[:{COUNTER32|COUNTER64|EXACT|MEMMAX=#|MEMMIN=#|NOEXACT|
NOPATH|NOTRACKEH|PATH|PGD=filename|TRACKEH}]
/HEAP:reserve[,commit]
/HIGHENTROPYVA[:NO]
/IDLOUT:文件名
/IGNORE:#
/IGNOREIDL
/ILK:filename
/IMPLIB:文件名
/INCLUDE:符号
/INCREMENTAL[:NO]
/INTEGRITYCHECK
/KERNEL
/KEYCONTAINER:name
/KEYFILE:文件名
/LARGEADDRESSAWARE[:NO]
/LIBPATH:目录
/LINKREPRO:dir
(按回车键继续)
/LINKREPROTARGET:filename
/LTCG[:{INCREMENTAL|NOSTATUS|OFF|STATUS|}]
/MACHINE:{ARM|ARM64|ARM64X|EBC|X64|X86}
/MANIFEST[:{EMBED[,ID=#]|NO}]
/MANIFESTDEPENDENCY:manifest dependency
/MANIFESTFILE:filename
/MANIFESTINPUT:文件名
/MANIFESTUAC[:{NO|UAC 片段}]
/MAP[:文件名]
/MAPINFO:{EXPORTS|PDATA}
/MERGE:from=to
/MIDL:@commandfile
/NATVIS:filename
/NOASSEMBLY
/NODEFAULTLIB[:库]
/NOENTRY
/NOIMPLIB
/NOLOGO
/NXCOMPAT[:NO]
/OPT:{ICF[=iterations]|LBR|NOICF|NOLBR|NOREF|REF}
/ORDER:@文件名
/OUT:文件名
/PDB:文件名
/PDBSTRIPPED[:filename]
/PROFILE
/RELEASE
/SAFESEH[:NO]
/SECTION:名称,[[!]{DEKPRSW}][,ALIGN=#]
/SOURCELINK:filename
(按回车键继续)
/STACK:reserve[,commit]
/STUB:filename
/SUBSYSTEM:{BOOT_APPLICATION|CONSOLE|EFI_APPLICATION|
EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER|
NATIVE|POSIX|WINDOWS|WINDOWSCE}[,#[.##]]
/SWAPRUN:{CD|NET}
/TLBID:#
/TLBOUT:文件名
/TIME
/TSAWARE[:NO]
/USEPROFILE[:{AGGRESSIVE|PGD=filename}]
/VERBOSE[:{CLR|ICF|INCR|LIB|REF|SAFESEH|UNUSEDDELAYLOAD|UNUSEDLIBS}]
/VERSION:#[.#]
/WINMD[:{NO|ONLY}]
/WINMDDELAYSIGN[:NO]
/WINMDFILE:文件名
/WINMDKEYCONTAINER:name
/WINMDKEYFILE:filename
/WHOLEARCHIVE[:library]
/WX[:NO]
If that doesn't work unfortunately I don't know how to fix this :(
@lygstate Can you double-check that you have Visual Studio English language pack installed (additionally to whatever your primary language pack) ? This VSLANG=1033 trick still works fine for me on my machine with VS2019.
@crlf0710 I had same issue, installing English language pack in the Visual Studio Installer solved it. I think cc-rs
should validate the MSVC language is in English and warn the user error messages may be silently dropped for non-english languages.
I think
cc-rs
should validate the MSVC language is in English and warn the user error messages may be silently dropped for non-english languages.
Makes sense. I'd take a PR for this.
See also https://github.com/rust-lang/cc-rs/issues/809#issuecomment-1552024139 which I think is related. We may be able to handle printing in the non UTF-8 case. But there's some complexity because cl.exe
et al have their roots in very old tools and don't use the same code page as most cli applications do.