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

scons still emits warnings about missing MSVC compiler #2813

Closed
bdbaddog opened this issue Jan 2, 2018 · 1 comment · Fixed by #4132
Closed

scons still emits warnings about missing MSVC compiler #2813

bdbaddog opened this issue Jan 2, 2018 · 1 comment · Fixed by #4132
Assignees
Labels

Comments

@bdbaddog
Copy link
Contributor

bdbaddog commented Jan 2, 2018

This issue was originally created at: 2012-01-11 15:41:25.
This issue was reported by: jmsachs.
jmsachs said at 2012-01-11 15:41:25

I'm running scons v2.1.0.r5357:

C:\tmp\svn\research-tools\trunk\sconstest>scons --version
SCons by Steven Knight et al.:
        script: v2.1.0.r5357[MODIFIED], 2011/09/09 21:31:03, by bdeegan on ubuntu
        engine: v2.1.0.r5357[MODIFIED], 2011/09/09 21:31:03, by bdeegan on ubuntu
        engine path: ['c:\\appl\\python\\2.7.2\\lib\\site-packages\\scons-2.1.0-py2.7-win32.egg\\scons-2.1.0\\SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation

I just ran it newly-installed on a PC in my office and it says this:

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

I thought this bug had been fixed; release 2.1.0 release notes says this:

From William Deegan:

  • Add initial support for VS/VC 2010 (express and non-express versions)
  • Remove warning for not finding MS VC/VS install.
    "scons: warning: No version of Visual Studio compiler found
    • C/C++ compilers most likely not set correctly"
  • Add support for Linux 3.0

Please fix it; the message is disrupting to our build and I can't figure out how to manage a workaround -- none of the approaches in this thread seem to work for me: https://comments.gmane.org/gmane.comp.programming.tools.scons.user/20861

@jcbrill
Copy link
Contributor

jcbrill commented Apr 11, 2022

This issue is still is present in the current scons code.

I believe the "Remove warning for not finding MS VC/VS install" was likely a reference to commenting out the warning in the method get_installed_vcs in vc.py. However, the "default" tool initialization is responsible for the warning being issued even if the user is not using msvc.

I have what I believe is a simple fix and will issue a PR soon.

A vm was setup with mingw-w64 installed (see mingw-w64 comments below) and without any VS installations.

Using the current master:

  • env = Environment(tools=['mingw'])

    scons: Reading SConscript files ...
    Build: _build001 {'tools': ['mingw']}
    
    scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: building associated VariantDir targets: _build001
    gcc -o _build001\hello.o -c hello.c
    gcc -o _build001\hello.exe _build001\hello.o
    scons: done building targets.
    
  • env = Environment()

    scons: Reading SConscript files ...
    Build: _build001 {}
    
    scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    
    scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: building associated VariantDir targets: _build001
    cl /Fo_build001\hello.obj /c hello.c /nologo
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    scons: *** [_build001\hello.obj] Error 1
    scons: building terminated because of errors.
    
  • env = Environment(MSVC_VERSION='14.3')

    scons: Reading SConscript files ...
    Build: _build001 {'MSVC_VERSION': '14.3'}
    
    scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    
    scons: warning: VC version 14.3 not installed.  C/C++ compilers are most likely not set correctly.
    Installed versions are: []
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    
    scons: warning: VC version 14.3 not installed.  C/C++ compilers are most likely not set correctly.
    Installed versions are: []
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    
    scons: warning: VC version 14.3 not installed.  C/C++ compilers are most likely not set correctly.
    Installed versions are: []
    File "..\scons-master\scripts\scons.py", line 98, in <module>
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: building associated VariantDir targets: _build001
    cl /Fo_build001\hello.obj /c hello.c /nologo
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    scons: *** [_build001\hello.obj] Error 1
    scons: building terminated because of errors.
    

Using proposed fix:

  • env = Environment(tools=['mingw'])

    scons: Reading SConscript files ...
    Build: _build001 {'tools': ['mingw']}
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: building associated VariantDir targets: _build001
    gcc -o _build001\hello.o -c hello.c
    gcc -o _build001\hello.exe _build001\hello.o
    scons: done building targets.
    
  • env = Environment()

    scons: Reading SConscript files ...
    Build: _build001 {}
    
    scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
    File "..\scons-msvc-warninstalled\scripts\scons.py", line 98, in <module>
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: building associated VariantDir targets: _build001
    cl /Fo_build001\hello.obj /c hello.c /nologo
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    scons: *** [_build001\hello.obj] Error 1
    scons: building terminated because of errors.
    
  • env = Environment(MSVC_VERSION='14.3')

    scons: Reading SConscript files ...
    Build: _build001 {'MSVC_VERSION': '14.3'}
    
    scons: warning: VC version 14.3 not installed.  C/C++ compilers are most likely not set correctly.
    Installed versions are: []
    File "..\scons-msvc-warninstalled\scripts\scons.py", line 98, in <module>
    
    scons: warning: VC version 14.3 not installed.  C/C++ compilers are most likely not set correctly.
    Installed versions are: []
    File "..\scons-msvc-warninstalled\scripts\scons.py", line 98, in <module>
    
    scons: warning: VC version 14.3 not installed.  C/C++ compilers are most likely not set correctly.
    Installed versions are: []
    File "..\scons-msvc-warninstalled\scripts\scons.py", line 98, in <module>
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: building associated VariantDir targets: _build001
    cl /Fo_build001\hello.obj /c hello.c /nologo
    'cl' is not recognized as an internal or external command,
    operable program or batch file.
    scons: *** [_build001\hello.obj] Error 1
    scons: building terminated because of errors.
    

    The proposed fix is relying on the first call to setup the environment without a defined MSVC_VERSION is the initialization of the default msvc tool environment.

    In the future, suppressing msvc tool initialization when there are no visual studio instances installed would require this fix to be removed.

    Mingw-W64 Note:

    I never paid much attention to how mingw is configured as I always manually add the requisite mingw path to the environment for specific combinations of the mingw tools (gcc version, sjlj vs SEH, posix vs win32, native 32-bit vs 64-bit).

    As configured in Tool\mingw.py, all of the mingw-w64 paths are for the 64-bit compiled versions (e.g., <MINGW64ROOT>\mingw64\bin). None of the 32-bit compiled versions (e.g., <MINGW64ROOT>\mingw32\bin) are included. The 32-bit paths should probably be before the 64-bit paths on 32-bit hosts and after the 64-bit hosts on 64-bit hosts.

    Parallel to the msvc tools, 64-bit hosts need to check for both the 64-bit and 32-bit builds while 32-bit hosts need only check for the 32-bit builds.

    I compile my own versions of mingw-w64 and still need versions that target 32-bit bits. 64-bit multi-host target builds require sjlj (i.e., multi-host builds cannot be built with SEH). Also, on a 32-bit host it is useful to use the multi-host builds to cross-compile for 64-bits.

    File away for future reference: using (mingw-w64) gcc.exe, (mingw-w64) gendef.exe and llvm-dlltool.exe, it is possible to build a windows DLL (.dll) AND produce a windows msvc import library (.lib) WITHOUT any MSVS versions installed. With a custom gcc specs file, it is possible to target multiple msvc runtime libraries (e.g., msvcr80.dll) given some constraints.

    Author Note:

    I am starting to have a proliferation of active branches all with changes in the msvc source files. The sequence of PR acceptance, if any or ever, coupled with the duration of time that a given PR is outstanding can have non-trivial maintenance/conflict resolution implications. This was experienced not long ago with the change in signature of the debug function in common.py that runs throughout the msvc code. Motivation drops precipitously in these instances.

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