Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[omniorb] Build of ANYTHING fails early on with "vcvarsall.bat returned 255" #38831

Open
j-xella opened this issue May 20, 2024 · 7 comments
Open
Assignees
Labels
category:question This issue is a question

Comments

@j-xella
Copy link

j-xella commented May 20, 2024

Operating system

WIN 10 Enterprise 22H2

Compiler

VS 2022

Steps to reproduce the behavior

vcpkg install omniorb:x64-windows --debug

Failure logs

...
[DEBUG] Found path: C:\Program Files\PowerShell\7\pwsh.exe
[DEBUG] 1006: CreateProcessW("C:\Program Files\PowerShell\7\pwsh.exe" --version)
[DEBUG] 1006: cmd_execute_and_stream_data() returned 0 after  1105716 us
[DEBUG] command line: cmd /d /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary/Build\vcvarsall.bat" -vcvars_ver=14.36.32532 amd64   2>&1 <NUL  & echo cdARN4xjKueKScMy9C6H & set
[DEBUG] 1007: CreateProcessW(cmd /d /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary/Build\vcvarsall.bat" -vcvars_ver=14.36.32532 amd64   2>&1 <NUL  & echo cdARN4xjKueKScMy9C6H & set)
[DEBUG] 1007: cmd_execute_and_stream_data() returned 255 after  2802303 us
[DEBUG] **********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.6.13
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************

error: while trying to get a Visual Studio environment, vcvarsall.bat returned 255
[DEBUG] D:\a\_work\1\s\src\vcpkg\base\system.process.cpp(1284):
[DEBUG] Time in subprocesses: 4694304us
[DEBUG] Time in parsing JSON: 462us
[DEBUG] Time in JSON reader: 855us
[DEBUG] Time in filesystem: 129544us
[DEBUG] Time in loading ports: 119141us
[DEBUG] Exiting after 4.9 s (4856342us)

Additional context

There were similar issues reported earlier:

However, this time it is with newer version of compilers, so maybe the problem is somewhere else?

The --debug invocation gives a command line that failed. When I replay that command

cmd /d /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary/Build\vcvarsall.bat" -vcvars_ver=14.36.32532 amd64   2>&1 <NUL  & echo cdARN4xjKueKScMy9C6H & set

in a new command window, I don't see any errors, just a list of environment variables:

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.6.13
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
cdARN4xjKueKScMy9C6H
ALLUSERSPROFILE=C:\ProgramData
APClientType=FAT
APDesktop=C:\Users\XXX\Desktop
APPDATA=C:\Users\XXX\AppData\Roaming
...

Versions:

  • vcpkg package management program version 2024-04-23-d6945642ee5c3076addd1a42c331bbf4cfc97457
  • vcpkg repository on commit 7eb700c9688daed6d8bdcdc571ebe3eedea6a774
@j-xella j-xella added the category:port-bug The issue is with a library, which is something the port should already support label May 20, 2024
@StarGate-One
Copy link
Contributor

cmd /d /c "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary/Build\vcvarsall.bat" -vcvars_ver=14.36.32532 amd64 2>&1 <NUL & echo cdARN4xjKueKScMy9C6H

One issue I see is the path - C:\Program Files (x86) is where Visual Studio 2019 and older reside as they were 32-bit (x86) programs. Visual Studio 2022 is 64-bit (x64) and should be found in C:\Program Files, that is unless the Visual Studio Installer was over-ridden to something other than the default when VS2022 was installed.

@FrankXie05 FrankXie05 added category:question This issue is a question and removed category:port-bug The issue is with a library, which is something the port should already support labels May 21, 2024
@j-xella
Copy link
Author

j-xella commented May 21, 2024

One issue I see is the path - C:\Program Files (x86) is where Visual Studio 2019 and older reside as they were 32-bit (x86) programs. Visual Studio 2022 is 64-bit (x64) and should be found in C:\Program Files, that is unless the Visual Studio Installer was over-ridden to something other than the default when VS2022 was installed.

I have no control over the location of VS - I request it and it gets installed from a centralized package repository in our organisation. That being said, installation location should not be of importance, right? Otherwise, VS 2022 seems to work OK, even when being installed in a wrong folder.

Copy link

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

@github-actions github-actions bot added the Stale label Jun 19, 2024
@FrankXie05 FrankXie05 changed the title Build of ANYTHING fails early on with "vcvarsall.bat returned 255" [omniorb] Build of ANYTHING fails early on with "vcvarsall.bat returned 255" Jun 25, 2024
@github-actions github-actions bot removed the Stale label Jun 26, 2024
@Filyus
Copy link

Filyus commented Jul 4, 2024

I'm not sure, but it seems the problem is the length limit of the command line arguments in Windows, it is equal to 8191 characters.
Command prompt (Cmd. exe) command-line string limitation

It appears that due to the large number of paths in the user PATH and the system PATH environment variables, vcvarsall.bat cannot execute successfully. You can try to remove unnecessary and duplicate paths in the user PATH that are already in the system PATH.

Also, there another length limitations:
What is the maximum length of an environment variable?

The theoretical maximum length of an environment variable is around 32760 characters.
All environment variables must live together in a single environment block, which itself has a limit of 32767 characters.

You can test it youself with the following bat file:

set VSCMD_DEBUG=0
set VCVARSALL_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build
call "%VCVARSALL_PATH%\vcvarsall.bat" -vcvars_ver=14.33.31629 amd64 

There must be two errors printed (about the length and about a command syntax).
Also, you can check the size of a generateddd_vsdevcmd17_preinit_env.log file.
In my case it is 20.4 KB in size.

@Filyus
Copy link

Filyus commented Jul 4, 2024

But actually the problem probably with a VSINSTALLDIR environment variable, it must be like this:
C:\Program Files\Microsoft Visual Studio\2022\Community\

Check list:

  • Disk letter
  • Program Files (x86) for older Visual Studio's
  • Year (2022, 2019, 2017 etc)
  • End slash

@Filyus
Copy link

Filyus commented Jul 4, 2024

Now I can successfully run vcvarsall.bat manually, but vcpkg install still shows the error:
error: while trying to get a Visual Studio environment, vcvarsall.bat returned 255

vcpkg runs vcvarsall.bat -vcvars_ver=14.33.31629 amd64 as in the above bat file and there no exit /B 255 in the vcvarsall.bat, so probably the error is somewhere else.

@Filyus
Copy link

Filyus commented Jul 4, 2024

In my case, updating Visual Studio 2022 Community fixes the problem!

Also, I removed extra Build Tools for Visual Studio 2022 (2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

4 participants