[Scons-users] Specify Toolchain for Windows
R0b0t1
r030t1 at gmail.com
Fri May 19 15:57:21 EDT 2017
On Fri, May 19, 2017 at 2:54 PM, R0b0t1 <r030t1 at gmail.com> wrote:
> On Fri, May 19, 2017 at 10:40 AM, Bill Deegan <bill at baddogconsulting.com> wrote:
>>
>>
>> On Fri, May 19, 2017 at 8:06 AM, R0b0t1 <r030t1 at gmail.com> wrote:
>>>
>>> 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"`
>>
>>
>> Typically modern pythons install the py.exe which you can use as follows:
>>
>> py -2 "C:\Python27\Scripts\scons.py"`
>> (and soon when scons 3.0)
>> py -3 "C:\Python27\Scripts\scons.py"`
>>
>> Also in your case you can do the following:
>>
>> (from powershell)
>> $ENV:PATH += ";C:\Python27\Scripts\"
>>
>> Then just run scons. (there should be a scons.bat installed there as well.
>>
>
> Yes, this works, thanks.
>
>>>
>>>
>>> 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)
>>> ```
>>>
>>
>> Point me to the installation kit you used for mingw and I'll try it on my
>> machine.
>> The above should work. If not likely there's a bug to be filed/fixed.
>>
>> Remove PATH from your Program(). Not needed.
>>
>
> I've removed it the explicit setting of PATH. I installed Python
> 2.7.13 from the installed found on the drop-down menu on
> https://python.org labelled "Download." I installed MinGW-w64 from the
> installer located at https://sourceforge.net/projects/mingw-w64/ - the
> string "x86_64-6.3.0-posix-seh-rt_v5-rev2" specifies the options which
> need selected.
>
> I installed MinGW manually some time ago but have since removed it, I
> am not precisely sure what reinstalled it.
>
My apologies, I forgot to add - it is installed into C:\MinGW,
everything looks like it was left at the defaults.
>>>
>>> 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.
>>
>>
>> Works for me and many others.
>> Windows is a first class platform for SCons.
>>
>> -Bill
>>
>
> I don't want this to go sour but "works for me" doesn't make my
> computer disobey the laws of physics and begin working. There are many
> projects which claim to support Windows when really they support the
> developer's installation of Windows, and may or may not work
> elsewhere.
>
> Why? Still trying to find out.
More information about the Scons-users
mailing list