Login | Register
My pages Projects Community openCollabNet

Discussions > Notification of Issues > RE: [Issue 2881] scons cannot compile d code on windows

Project highlights:

14 Nov 2017: Release 3.0.1 is now available at the download page.

18 Sep 2017: Release 3.0.0 is now available at the download page.

03 Nov 2016: Release 2.5.1 is now available at the download page.

scons
Discussion topic

Hide all messages in topic

All messages in topic

Re: [Issue 2881] scons cannot compile d code on windows

Author bdbaddog
Full name William Deegan
Date 2013-02-05 12:58:09 PST
Message Russel,

The substance of this bug seems to be:
SCons can't find my D installed at a non-standard location.

Followed by:
You should fix it by propagating the users shell PATH value into SCons.

Although there may be issues with D on windows, I don't think the issue you are talking about match the substance of this bug filing.
Do they?

If so then I agree this bug should be reopened.
If they do not, and you have some specifics then you or we should file a placeholder bug with each issue which makes sense to address separately.

Hope that helps!
-Bill
On Feb 5, 2013, at 11:36 AM, russel at tigris dot org wrote:

> http://scons.tigris.​org/issues/show_bug.​cgi?id=2881
>
>
>
>
>
>
> ------- Additional comments from russel at tigris dot org Tue Feb 5 11:36:02 -0800 2013 -------
> Bill,
>
> There is a bug here, the D tools behave incorrectly and differently to the C++
> tools. The proposed fix is not the correct one for exactly the reasons people are
> giving. The issue for me is that the way the D tools behave needs to be fixed. Is
> it best to reopen this issue or just get another sans the erroneous "fix".
>
> --------------------​--------------------​--------------
> http://scons.tigris.​org/ds/viewMessage.d​o?dsForumId=1271​&dsMessageId=3047747​
>
> To unsubscribe, send an e-mail to [issues-unsubscribe@​scons.tigris.org].

[Issue 2881] scons cannot compile d code on windows

Author russel
Full name Russel Winder
Date 2013-02-05 11:36:02 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881






------- Additional comments from russel at tigris dot org Tue Feb 5 11:36:02 -0800 2013 -------
Bill,

There is a bug here, the D tools behave incorrectly and differently to the C++
tools. The proposed fix is not the correct one for exactly the reasons people are
giving. The issue for me is that the way the D tools behave needs to be fixed. Is
it best to reopen this issue or just get another sans the erroneous "fix".

[Issue 2881] scons cannot compile d code on windows

Author bdbaddog
Full name William Deegan
Date 2013-02-05 11:22:00 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881



User bdbaddog changed the following:

                What |Old value |New value
====================​====================​====================​====================​
                  Status|NEW |RESOLVED
--------------------​--------------------​--------------------​--------------------​
              Resolution| |INVALID
--------------------​--------------------​--------------------​--------------------​




------- Additional comments from bdbaddog at tigris dot org Tue Feb 5 11:22:00 -0800 2013 -------

Please read FAQ.
SCons does the best it can to find tools in their standard locations and/or
using system information to locate them if installed in user specified locations.
This does not include propagating the users environment, especially PATH, by
default.

So the issue really is does the installer store the installation information the
windows registry such that we can retrieve it and/or does it store that
information in a separate shell variable (not PATH) which could be used to set
the path to D tools with.

I just installed DMD in a VM and can't find any registry or env entries other
than PATH which contain the location of D in it.

Note that you're install location is not the default install location.
C:\D\dmd2\windows\bin

As such the best we can suggest at this point in time is that you should either
set the PATH in your SConstruct, or explicitly set the location of your D in
env['DC']

Note there are current discussions on improvements to the tools infrastructure
which may improve this issue, but at current SCons is behaving as expected so
I'm marking this bug as invalid.

[Issue 2881] scons cannot compile d code on windows

Author egust
Full name eGust
Date 2013-02-04 19:11:39 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881






------- Additional comments from egust at tigris dot org Mon Feb 4 19:11:39 -0800 2013 -------
Environment
platform: win7 x64
compiler: dmd v2.060
compilers in %PATH%:
  dmd D:\Develop\dmd2\windows\bin
  mingw32 D:\Develop\gcc\mingw32\bin
  mingw64 D:\Develop\gcc\MinGW64\bin
  python273 D:\Develop\Python27
other installed compilers:
  msvs 2010

Steps:
1. Prepare some files:
  A simple D file: hw.d
  A SCons file: SConstruct
  A batch file: issue2890.bat
  2 py files, which are the original scons-2.2.0/SCons/Pl​atform/win32.py and the
patched one: win32.old.py win32.new.py

2. Run the batch file as command:
  issue2890 1>issue2890.log 2>&1

And the issue is showed in the log.

All the files are attached:
http://scons.tigris.​org/nonav/issues/sho​wattachment.cgi/912/​issue2890.zip.
--

The log shows:
1. When using original scons-2.2.0/SCons/Pl​atform/win32.py
env['ENV']['PATH'] stored only msvs paths and C:\Windows\System32. Both
env.WhereIs('dmd') and env.Detect(['dmd']) got None. So SCons could not use
right compiler to build files, it just called link.exe to try to link the source
file and, of cause, got an error.

2. When using the patched one:
env['ENV']['PATH'] also stored all compilers in %PATH% (dmd, mingw32, mingw64,
py...). env.WhereIs('dmd') and env.Detect(['dmd']) returned right values. And
SCons correctly called dmd.exe to compile and link the source file.

[Issue 2881] scons cannot compile d code on windows

Author bdbaddog
Full name William Deegan
Date 2013-02-03 21:14:38 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881






------- Additional comments from bdbaddog at tigris dot org Sun Feb 3 21:14:38 -0800 2013 -------
*** Issue 2890 has been marked as a duplicate of this issue. ***

Re: [Issue 2881] scons cannot compile d code on windows

Author bdbaddog
Full name William Deegan
Date 2013-02-03 21:13:24 PST
Message EGust,

This is not a bug. This is by design.

Dirk's reference to the FAQ is a reasonable response.

From the FAQ:

> SCons does not automatically propagate the external environment used to execute 'scons' to the commands used to build target files. This is so that builds will be guaranteed repeatable regardless of the environment variables set at the time scons is invoked. This also means that if the compiler or other commands that you want to use to build your target files are not in standard system locations, SCons will not find them unless you explicitly set the PATH to include those locations


If you'll read the remainder of the FAQ referenced, you'll see a way to propagate the user's environment into your SConstruct.
So SCons doesn't prevent you from doing so, but as explained the quote, by design it doesn't propagate the user's environment to ensure a repeatable build (and not just for the author of the SConstruct/SConscripts)

Hope that helps!

-Bill


On Feb 3, 2013, at 10:10 AM, eGust <egustc at gmail dot com> wrote:

> Why did u rebuke users instead of finding the bug? Your reply was rude.
> The bug is:
> SCons.Platform.win32.py:
> line #342 should be:
> import_env = [ 'SystemDrive', 'SystemRoot', 'TEMP', 'TMP', 'PATH', ]
>
> 'PATH' is missed so env['ENV']['PATH'] has never been initialized correctly. So Base.WhereIs in SCons.Environment can't get right path and causes reported problems.
>
>> http://scons.tigris.​org/issues/show_bug.​cgi?id=2881
>>
>>
>>
>>
>>
>>
>> ------- Additional comments from dirkbaechle at tigris dot org Tue Nov 13 00:04:35 -0800 2012 -------
>> Hi,
>>
>> did you already have a look at our FAQ (
>> http://scons.org/wik​i/FrequentlyAskedQue​stions ) ? ;) If not, try point 2.1 in
>> the list...
>>
>> Best regards,
>>
>> Dirk
>
> --------------------​--------------------​--------------
> http://scons.tigris.​org/ds/viewMessage.d​o?dsForumId=1271​&dsMessageId=3047400​
>
> To unsubscribe, send an e-mail to [issues-unsubscribe@​scons.tigris.org].

RE: [Issue 2881] scons cannot compile d code on windows

Author egust
Full name eGust
Date 2013-02-03 10:10:11 PST
Message Why did u rebuke users instead of finding the bug? Your reply was rude.
The bug is:
SCons.Platform.win32.py:
line #342 should be:
    import_env = [ 'SystemDrive', 'SystemRoot', 'TEMP', 'TMP', 'PATH', ]

'PATH' is missed so env['ENV']['PATH'] has never been initialized correctly. So Base.WhereIs in SCons.Environment can't get right path and causes reported problems.

> http://scons.tigris.​org/issues/show_bug.​cgi?id=2881
>
>
>
>
>
>
> ------- Additional comments from dirkbaechle at tigris dot org Tue Nov 13 00:04:35 -0800 2012 -------
> Hi,
>
> did you already have a look at our FAQ (
> http://scons.org/wik​i/FrequentlyAskedQue​stions ) ? ;) If not, try point 2.1 in
> the list...
>
> Best regards,
>
> Dirk

[Issue 2881] scons cannot compile d code on windows

Author russel
Full name Russel Winder
Date 2012-11-13 01:17:51 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881






------- Additional comments from russel at tigris dot org Tue Nov 13 01:17:50 -0800 2012 -------
Dirk,

I asked for this issue to be posted since it related to all the hassles with the
D tooling on Windows. Point 2.1 you refer to doesn't apply here as the D tooling
should "Just Work"™ in the same way the C++ tooling does.

This issue relates to the fact that the DMD, LDC and GDC tool do not correctly
interwork with the linker tooling for Windows, and indeed Linux and OS X.

I need a collaborator who uses windows, SCons and D to work with me to fix all
this, as I can only deal with Linux and OS X.

[Issue 2881] scons cannot compile d code on windows

Author dirkbaechle
Full name Dirk Baechle
Date 2012-11-13 00:04:36 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881






------- Additional comments from dirkbaechle at tigris dot org Tue Nov 13 00:04:35 -0800 2012 -------
Hi,

did you already have a look at our FAQ (
http://scons.org/wik​i/FrequentlyAskedQue​stions ) ? ;) If not, try point 2.1 in
the list...

Best regards,

Dirk

[Issue 2881] New - scons cannot compile d code on windows

Author ariovistus
Full name Ariovistus
Date 2012-11-12 18:31:43 PST
Message http://scons.tigris.​org/issues/show_bug.​cgi?id=2881
                 Issue #|2881
                 Summary|scons cannot compile d code on windows
               Component|scons
                 Version|SVN
                Platform|All
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P4
            Subcomponent|scons
             Assigned to|russel
             Reported by|ariovistus






------- Additional comments from ariovistus at tigris dot org Mon Nov 12 18:31:42 -0800 2012 -------
Simple example:

SConstruct:
Program("test",["test.d"])
test.d:
void main() {}

> scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
I. -c -oftest.o test.d
sh: I.: command not found
oftest.exe test.o
sh: oftest.exe: command not found
scons: done building targets.

The problem is scons can't find a d compiler, even if one exists in %PATH%.

In SCons/Tool/dmd.py:
env.Detect(['dmd','gdmd']) returns None.
dmd exists in %PATH%; but scons doesn't look there for some reason.
Scons.Util.WhereIs gets passed "C:\Windows\System32", which is not where dmd is.

Apparently, the environment path needs to be fiddled with like what is done in
SCons/Tool/MSCommon/​vc.py:msvc_setup_env​.

On linux, WhereIs gets passed "/usr/local/bin:/opt​/bin:/bin:/usr/bin",​ so it
could suffer the same problem.
Messages per page: