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

Failed to generate vsproj with scons 4.6.0 #85262

Closed
charlietsao opened this issue Nov 23, 2023 · 7 comments · Fixed by #85357
Closed

Failed to generate vsproj with scons 4.6.0 #85262

charlietsao opened this issue Nov 23, 2023 · 7 comments · Fixed by #85357

Comments

@charlietsao
Copy link

Godot version

4.1.3-stable

System information

Windows 10

Issue description

Scons build succeed. However, scons generate vsproj failed:

> scons p=windows vsproj=yes
scons: Reading SConscript files ...
Auto-detected 16 CPU cores available for build parallelism. Using 15 cores by default. You can override it with the -j argument.
Found MSVC version 14.2, arch x86_64
Building for platform "windows", architecture "x86_64", target "editor".
KeyError: 0:
  File "E:\fdx\godot\SConstruct", line 971:
    methods.generate_vs_project(env, ARGUMENTS, env["vsproj_name"])
  File "E:\fdx\godot\methods.py", line 780:
    batch_file = find_visual_c_batch_file(env)
  File "E:\fdx\godot\methods.py", line 732:
    return find_batch_file(env, version, host_platform, target_platform)[0]
  File "C:\Users\fdx\AppData\Local\Programs\Python\Python310\lib\site-packages\SCons\Tool\MSCommon\vc.py", line 929:
    vernum = float(get_msvc_version_numeric(msvc_version))
  File "C:\Users\fdx\AppData\Local\Programs\Python\Python310\lib\site-packages\SCons\Tool\MSCommon\vc.py", line 504:
    return ''.join([x for x in msvc_version if x in string_digits + '.'])
  File "C:\Users\fdx\AppData\Local\Programs\Python\Python310\lib\site-packages\SCons\Tool\MSCommon\vc.py", line 504:
    return ''.join([x for x in msvc_version if x in string_digits + '.'])
  File "C:\Users\fdx\AppData\Local\Programs\Python\Python310\lib\site-packages\SCons\Environment.py", line 586:
    return self._dict[key]

Steps to reproduce

  1. Install Visual Studio 2019
  2. run scons p=windows vsproj=yes

Minimal reproduction project

No project, just build.

@akien-mga
Copy link
Member

Which scons version do you have installed?

@charlietsao
Copy link
Author

Which scons version do you have installed?

It's v4.6. Sorry I accidentally closed the issue just now.

> scons --version
SCons by Steven Knight et al.:
        SCons: v4.6.0.e5eef322a4a727b96358a436dca46e8085ac8692, Sun, 19 Nov 2023 17:22:20 -0700, by bdbaddog on M1Dog2021
        SCons path: ['C:\\Users\\fdx\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\SCons']
Copyright (c) 2001 - 2023 The SCons Foundation

@akien-mga
Copy link
Member

I just tried on Windows with SCons 4.6.0 and I can reproduce the issue too. It must be a regression from the newly released 4.6.0.

@akien-mga akien-mga added this to the 4.2 milestone Nov 23, 2023
@akien-mga akien-mga self-assigned this Nov 23, 2023
@akien-mga akien-mga changed the title Failed to generate vsproj with scons Failed to generate vsproj with scons 4.6.0 Nov 23, 2023
@brno32
Copy link
Contributor

brno32 commented Nov 24, 2023

I think something like #84553 could help in this situation, but that would require quite a few documentation updates as mentioned by @YuriSizov and wouldn't be consistent with how other dependencies are used within the project.

That aside, it is a good question as to what a user should do in this situation. Until SСons releases a patch, anyone who tries to compile godot from source and follows the docs with vsproj=yes will encounter this error, as plain ol' pip install scons is broken for the time being (since it grabs the latest version).

@levidavidmurray
Copy link

For anyone else stumbling face first into this, run: pip install SCons==4.5.2

@mwichmann
Copy link

Looks like find_batch_file from SCons.Tool.MSCommon.vc in 4.6, which is called from methods.py, no longer takes an initial environment argument (the only usage of that was removed in SCons/scons@7082c53ff6 and so apparently the function signature was also adjusted):

-def find_batch_file(env, msvc_version, host_arch, target_arch):
+def find_batch_file(msvc_version, host_arch, target_arch, pdir):

Sounds a bit rude when I say it, but this function isn't a documented "public API" of SCons, so it doesn't come with API consistency promises. Nonetheless, apologies for the breakage.

@mhilbrunner
Copy link
Member

@mwichmann Thanks for the help with this, and no worries, that seems absolutely fine. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants