Scons doesn't find the Visual Studio compiler

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LazyTurtle

I’m trying to build the Godot engine from source, but when I try to build using Scons I get an error:

A:\Dati\Programming Tools\godot-3.2.1>scons p=windows
scons: Reading SConscript files ...

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "A:\Dati\Programming Tools\godot-3.2.1\SConstruct", line 3, in <module>

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "A:\Dati\Programming Tools\godot-3.2.1\SConstruct", line 65, in <module>
Configuring for Windows: target=debug, bits=default
Using MinGW
Couldn't parse CXX environment variable to infer compiler version.
YASM is necessary for WebM SIMD optimizations.
WebM SIMD optimizations are disabled. Check if your CPU architecture, CPU bits or platform are supported!
TypeError: argument of type 'ListAction' is not iterable:
  File "A:\Dati\Programming Tools\godot-3.2.1\SConstruct", line 534:
  File "c:\users\lazytortoise\appdata\local\programs\python\python38-32\lib\site-packages\scons\SCons\Script\", line 660:
    return method(*args, **kw)
  File "c:\users\lazytortoise\appdata\local\programs\python\python38-32\lib\site-packages\scons\SCons\Script\", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "c:\users\lazytortoise\appdata\local\programs\python\python38-32\lib\site-packages\scons\SCons\Script\", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "A:\Dati\Programming Tools\godot-3.2.1\modules\SCsub", line 20:
    env.split_lib("modules", env_lib = env_modules)
  File "A:\Dati\Programming Tools\godot-3.2.1\", line 335:
    if '-Wl,--start-group' in env['LINKCOM'] and '-Wl,--start-group' in env['SHLINKCOM']:

I have:

  • Godot v3.2.1
  • Visual Studio Community 2019 v16.5.3 (with C++ support)
  • Python v3.8.2
  • Scons v3.1.2

All the lastest versions of the softwares.

I found this possible explanation for the problem, but I don’t think its fix is viable in this case (I would have to change all python scripts and I’m not proficient in python, and it would surelly break something else).

Is there anything I can do?

Are you running SCons from the Native Tools Cmd promt? If not try doing that. Just search for “x64 Native Tools Command Prompt for VS2019” in the start menu.

omggomb | 2020-04-09 09:25

How embarrassing, I didn’t see the email for your comment and only now I’ve found out why I have this problem, sort of.

To answer your question, yes I did it. It was one of the first alerts on the documentation, I tried with the standard Windows command line, with PowerShell and with the command line provided by visual studio. But it changed nothing.

In the last week I had plenty of time to try again, and again. On a different pc I managed to do everything without much problems. So I experimented with my faulty machine until I found out because my default installation path isn’t the standard C://Program Files… but something different that Scons didn’t like. Even when everything was manually installed on the same drive.

I kept experimenting and even when I uninstalled everything, restored the default installation path and reinstalled everything ( visual studio, python, scons) ButI kept having the same problem.

After a clean reinstallation of Windows, without changing the default installation path, scons worked fine. I then formatted again and installed with the path modified, and the problem presented itself once again.

So the problem seems to be that I modified the default installation path of programs in the global environment variables list. The only solution I found was a clean reinstallation of Windows since even when everything has been reinstalled with the default paths it still wouldn’t work properly.

LazyTurtle | 2020-05-05 18:12