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
Build as administrator is required on windows (sometimes?) #4440
Comments
Well, the error is a compiler error, not an SCons error - SCons has found and executed a compiler binary. It seems it's trying to create a file somewhere that it hasn't the rights to, which is why running with admin rights helps. I'd be looking at the settings of environment variables There are other ways to specify the version you want to use, though those have evolved somewhat since 4.0, so you shouldn't have to resort to your own call to vswhere (scons is going to do that anyway) but that's not the problem since you've shown it's finding it already, since 14.2x is the 2019 series.
Out of curiosity, why make it so complicated? @jcbrill any thoughts here? |
@mwichmann I set it up to just run scons from the shell in the appropriate python environment. At some point I took on other responsibilities and someone else made that change, and I don't know why, unfortunately. But I am still asked for help by users when the build system doesn't work since I created it initially. |
Not much to add yet. This thread seems to be similar:
At present, it sounds like a Windows environment issue. In addition to checking that the https://stackoverflow.com/questions/52152923/vs2017-build-returns-d8050-failed-to-get-command-line-into-debug-records |
SCons made this change:
way back in
The change to automatically propagate |
|
Yes, I think it missed the 4.3.0 release by a couple of weeks. diff --git a/SCons/Platform/win32.py b/SCons/Platform/win32.py
index eeb2abff4..990794f96 100644
--- a/SCons/Platform/win32.py
+++ b/SCons/Platform/win32.py
@@ -381,7 +381,7 @@ def generate(env):
# for SystemDrive because it's related.
#
# Weigh the impact carefully before adding other variables to this list.
- import_env = ['SystemDrive', 'SystemRoot', 'TEMP', 'TMP' ]
+ import_env = ['SystemDrive', 'SystemRoot', 'TEMP', 'TMP', 'USERPROFILE']
for var in import_env:
v = os.environ.get(var)
if v: |
Typical
Typical
If the User Variable |
Try upgrading to latest SCons... |
The windows environment issue experienced is reproducible when both If either FAILS from a "normal" windows command-line prompt without
PASSES from an admin windows command prompt without
PASSES from a "normal" command-line prompt with either
Edits:
|
If |
I don't see that he said those aren't defined..? |
That was us running off and speculating on possible causes, and now testing (thanks @jcbrill for confirming which case it - likely - is) based on some other instances of similar. |
Research notes thus far based on the issue report above, search results, msvc documentation, and command-line experiments for posterity. There appears to be a confluence of events based on the windows environment and an msvc debug build that can result in build failures:
This is not specific to SCons and can be reproduced in a windows command-line environment. The behavior experienced is exactly the same as described in the second and third items below. Background information:
While there does not appear to be specific documentation for Test methodology for windows environment without SCons for failed build:
Procmon excerpts for a failed build:
The attempt to create a file for writing in
Test methodology for admin windows environment without SCons for successful build:
Procmon excerpts from a successful build:
The attempt to create a file for writing in The The environment variable This succeeds in an admin command interpreter due to the ability to read/write into the |
Seems like the user should FIRST try upgrading to latest SCons which we know has better MSVC logic and then we can spend any time trying to debug their issue.. |
@jcbrill @bdbaddog @mwichmann |
Are they running these from powershell or cmd.exe shell? We have seem weird issues in the past where anti-virus could impact such things. So the original user no longer has the issue, but another user does and it's currently reproducible? Can you share the most minimal SConstruct which reproduces this?
Would that do it? |
The installed Visual Studio version number might be helpful as well (e.g., 16.1, 16.2). Is vs2019 updated to the latest version? |
The original error message posted above in Nov 2023 shows toolset version 14.20.27508 which is a very early 2019 toolset and possibly the very first toolset. The latest toolset version for 2019 is 14.29.30133. Have updates to VS2019 been applied after the initial installation? Note that the v142 tools can be used in VS2022 by using the MSVC_TOOLSET_VERSION construction variable: Environment(MSVC_VERSION='14.3', MSVC_TOOLSET_VERSION='14.2', ...) |
SCons version: 4.0.1, installed via pip from pypi
Python 3.10 from python.org
Windows 10, Visual Studio 2019.
We use
MSVC_USE_SCRIPT=GetVCVarsPath()
, function defined above. Users might also have Visual Studio 2022 installed, but this build requires VS2019.Describe the bug
I set up a scons-based build system at my organization. Some users have complained to me that they can only run the build as administrator. I am not able to reproduce that problem myself. Here is the error message that the users who are affected get when they build as a non-admin.
cl : Command line error D8050 : cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64\c1xx.dll': failed to get command line into debug records
scons: building terminated because of errors.
I can try to get a minimal reproducible example, but apparently any c++ scons build is affected for these users. We use Visual Studio 2019
scons is invoked from python in a virtual environment where scons is installed as a subprocess. The executable in the subprocess is determined using the result of the subprocess
where scons
.The text was updated successfully, but these errors were encountered: