[Scons-users] compiler detection

Kraus Philipp philipp.kraus at flashpixx.de
Mon Oct 29 13:21:19 EDT 2012



Am 29.10.2012 um 17:57 schrieb William Deegan:


> Phil,

> On Oct 29, 2012, at 9:42 AM, Philipp Kraus <philipp.kraus at flashpixx.de> wrote:

>

>> On 2012-10-29 02:51:40 +0100, William Deegan said:

>>

>>> Phil,

>>> On Oct 28, 2012, at 9:22 AM, Kraus Philipp <philipp.kraus at flashpixx.de> wrote:

>>> Am 28.10.2012 um 16:50 schrieb William Deegan:

>>> Phil,

>>> On Oct 28, 2012, at 7:35 AM, Philipp Kraus <philipp.kraus at flashpixx.de> wrote:

>>> On 2012-10-25 21:09:30 +0200, William Deegan said:

>>> Phil,

>>> On Oct 25, 2012, at 12:46 AM, Kraus Philipp <philipp.kraus at flashpixx.de> wrote:

>>> Hello,

>>> I'm using on Windows 7 Visual Studio and MinGW Shell with Gcc / G++. If I run Scons on the VS command line, Scons uses on env.Program the VS compiler (cl.exe), on the other hand if I run Scons from the MinGW shell, it uses also the cl.exe, but not the g++.exe. I can now overwrite the CXX / CC flag in the env, but why does Scons uses always the Visual Studio compiler? The PATH variable under MinGW shell does not have any path information to Visual Studio. IMHO I would like to detect and use under VS command line the VS compiler & linker (cl.exe & link.exe) and under MinGW shell the gcc / g++.

>>> On win32 there's a list (in order) of the compilers to search for.

>>> If you want to detect the platform and change the preferences, you can list the tools (mingw…) when you initialize the Environment() you are using.

>>> Do you have got a code excerpt how to change this list?

>>> Go read the man page.

>>> http://www.scons.org/doc/production/HTML/scons-man.html (search for tool=)

>>> Basically

>>> Environment(tool=['mytool1','mytool2',…

>>> You can see the list of tools in the man page as well.

>>> I know the tool option, but how I can change the compiler search list? Should I rewrite the full tool list in the dependcy of my environment?

>>> tool= overrides the default tool initialization

>>> so

>>> env=Environment(tool=[])

>>> Initializes no tools, and then you could also add them via:

>>> env.Tool('gcc')..

>>

>> My mistake was, that I does not have set the tool to []. I'm using now on MinGW env.Tool("mingw") and otherwise env.Tool("default"):

>> That works fine.

>>

>> But I have got on MinGW a "shell" problem, because I use 2 env.Command lines, and this commands are always run on cmd.exe, but MinGW uses by default /bin/sh

>> I try to setup env["SHELL"] = "/bin/sh" and the PATH variable in my env object, but by the env.Command line I get always that /bin/sh is not found (and the command

>> creates an error).

>

> Can you put:

> if not os.path.exists('/bin/sh'):

> print "I can't find that binary"

>

> And see what it prints?

>

> It could be that your python doesn't understand /bin/sh and expects /c/bin/sh or c:/bin/sh or something like that?


It prints the message. I have tested also /c/<path to mingw bin>/sh (sh.exe) but on each call the shell is not found in the env.command.
With cmd.exe it works well, but I need an unix-based shell in the command call

Phil


More information about the Scons-users mailing list