[Scons-users] Specify Toolchain for Windows

R0b0t1 r030t1 at gmail.com
Fri May 19 11:06:47 EDT 2017


On Thu, May 18, 2017 at 2:03 PM, Zarko Berberski (Aditi Staffing LLC)
via Scons-users <scons-users at scons.org> wrote:
> Are you launching scons.py from some command shell/script ?
>
> The setup I'm working with uses cygwin64 and the build script adds "C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin" (and the whole slew of others) so scons.py already has it and doesn't need build.
>
> When I need to invoke scons.py standalone (like form a debugger) I inject a file by adding something like:
>
> Import os, sys
> SconsStarter = os.path.join( os.path.dirname(__file__), "SconsStarter.py")
> execfile(SconsStarter)
>
> to the very beginning of scons.py and SconsStarter.py adds all paths I need, like:
> ----------------------------------------------------------------------------
> BuildRoot = r"C:\cygwin64\home\v-zaberb"
>
> BuildPath = [
>               r"C:\ocamlmgw64\bin",
>               r"C:\PROGRA~2\MICROS~1.0\VC\bin\amd64",
>               r"C:\PROGRA~2\MICROS~1.0\VC\bin",
>               r"C:\PROGRA~2\MICROS~4\F#\4.0\FRAMEW~1\v4.0/",
>               r"C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin"
> ]
>
> SconsPath = [ join(sys.prefix, 'scons'),    # throwaway, scons.py eats sys.path[0]
>               join(sys.prefix, 'Lib', 'site-packages', 'scons-2.5.0'),
>               join(sys.prefix, 'Lib', 'site-packages', 'scons-2.5.0', 'scons')
>               ]
>
> sys.path = SconsPath + BuildPath + sys.path
> ----------------------------------------------------------------------------
>
> Oh and you do need to put one extra path at the top of your sys.path since scons.py is just going to eat it :-) Not kidding:
>
> https://bitbucket.org/scons/scons/src/f34900d9bfd84fd3c44ebe5763dfad0e8bb1e247/src/script/scons.py?at=default&fileviewer=file-view-default#scons.py-68
>

I am running SCons from PowerShell:

`C:\Python27\python.exe "C:\Python27\Scripts\scons.py"`

The Python 2.7 installer didn't add itself to my path, and it
conflicts with Python 3.6. Consequently I run SCons by referencing
both locations explicitly.

This seems to work, but SCons is using a MinGW installation that was
either installed alongside Python 2.7 or incidentally by some other
POSIX-software-for-Windows package.

I tried to duplicate the path as you recommended, but SCons is still
trying to use the old toolchain:

```Python
path = ['C:/MinGW/x86_64-6.3.0-posix-seh-rt_v5-rev2/mingw64/bin',
        'C:/MinGW/x86_64-6.3.0-posix-seh-rt_v5-rev2/mingw64/bin']

environ = Environment(tools=[])
environ.PrependENVPath('PATH', path)
environ.Tool('default')

shooter = environ.Program(target=target, source=sources,
    PATH=path, LIBS=libraries, CPPPATH=incpath, LIBPATH=libpath)
```

I appreciate the discussion and can't complain about the quality of
the help, but my experience with SCons on Windows indicates to me that
there is *no* build system that is easy to use on Windows. If SCons
worked, it would be easier to configure than CMake (far easier), but
as it is it doesn't seem to work and I may need to move back to CMake.

Cheers, R0b0t1.


More information about the Scons-users mailing list