Cannot configure on Windows in Chinese Environment

吴 国璋 zcxsythenew at outlook.com
Wed Nov 15 10:29:28 UTC 2023


I did some test on my machine, and the results are shown below:

- If I run `bash configure` with Chinese and English language pack installed, the command will succeed and cl.exe presents itself in English.
- If I run cl.exe directly, it presents itself in Chinese, based on my Windows language settings.

Given the above 2 facts, now we have several questions to answer, if we want to investigate the issue further:

1. Why `bash configure` works?

I inserted a command `env` before Line 985 of `make/autoconf/toolchain.m4`, to find out what difference does `bash configure` make. And it shows that `bash configure` adds the following environment variables:

> LANGUAGE=C
> as_nl=
> SHLVL=3
> DUALCASE=1
> LC_ALL=C

However, none of these environment variables work when I run cl.exe directly. I don't know why `bash configure` can work, and it seems like some magic to me.

2. Does `VSLANG=1033` work?

Yes, it works. If I run `VSLANG=1033 cl` in Cygwin terminal, cl.exe will present itself in English (language pack required). And there is a document about VSLANG, though this document is for vcpkg, not directly for cl.exe:

https://learn.microsoft.com /vcpkg/users/config-environment

3. How to install Visual Studio language packs?

As we know, Visual Studio is called "Visual" Studio, so most of its configurations are performed through GUI. To install the language pack:

- Click on "Visual Studio Installer" in Start menu.
- Click "Modify".
- Select the tab "Language packs".
- Choose "English".
- Click "Modify".

The command "vs_installer.exe --locale en-US" you mentioned just changes the installer itself to English.

-----邮件原件-----
发件人: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com> 
发送时间: 2023年11月14日 23:00
收件人: 吴国璋 <zcxsythenew at outlook.com>; build-dev at openjdk.org
主题: Re: Cannot configure on Windows in Chinese Environment

On 2023-11-14 15:41, Magnus Ihse Bursie wrote:

> However, I'd like to have some more investigation into how cl.exe 
> picks the language.
>
> Is it a hard-coded behavior that it always picks English if it is 
> installed? If so, it does not really make sense to have more than one 
> language pack installed. Or is there some way to tell cl.exe which 
> language to pick? Perhaps we send those signals without realizing it, 
> like if it happens to look at LC_ALL. If that is the case, we need to 
> know about this, so we don't inadvertently break it.
>
It seems that setting the environment variable VSLANG=1033 should do the trick. Some reports on the Internet indicates that this perhaps needs to be coupled with a "chcp 437".

Can you please test if that works? If you try setting VSLANG=2052, does that force cl.exe to use the Chinese locale? If it does, happens if you combine VSLANG=2052 with chcp 437?

If we are lucky, then this will boil down to

a) instructions in the documentation to install the English language pack of Visual Studio, and

b) adding VSLANG=1033 to the makefiles.

but I'd like to get some confirmation that VS really works like that.

I have a vague memory of a discussion about VSLANG=1033 before, that it did not help, but maybe the core issue at that time was that the language pack was not installed, which made VS ignore the VSLANG variable.

/Magnus




More information about the build-dev mailing list