[Scons-users] Still trouble using scons with MinGW

William Deegan bill at baddogconsulting.com
Wed Jun 13 14:40:55 EDT 2012


Sebastian,
On Jun 13, 2012, at 6:03 AM, Sebastian Gesemann wrote:


> Hallo!

>

> Having skimmed the SCons documentation I wanted to test it and see how

> I can avoid writing different Makefiles for different platforms. But I

> can't get SCons to properly use the MinGW tool chain under Windows 7.

>

> Here's what i did so far:

>

> The project just covers two cpp files and a couple of headers all in

> one directory:

> main.cpp

> linalg.cpp

>

> The first SConstruct file with the content of just the following single line

> Program('test',['main.cpp','linalg.cpp'])

> made SCons print:

> scons: Reading SConscript files ...

> scons: done reading SConscript files.

> scons: Building targets ...

> cl /Folinalg.obj /c linalg.cpp /TP /nologo

> Der Befehl "cl" ist entweder falsch geschrieben oder konnte nicht

> gefunden werden.

> scons: *** [linalg.obj] Error 1

> scons: building terminated because of errors.

>

> Since I currently don't have any Microsoft Compiler installed invoking

> a non-existant "cl" won't work, of course. From the SCons FAQ I

> learned that SCons does not automatically search for tool chains using

> the PATH variable. So, I adjusted the SConstruct file accordingly:

> import os

> env = Environment(ENV = {'PATH':os.environ['PATH']})

> env.Program('test',['main.cpp','linalg.cpp'])

> which did not seem to help at all. SCons still tries to use the

> compiler cl.exe even though it does not exist and it should be able to

> find g++ using the PATH variable. On the official Wiki I found an

> entry that tells me how I can make SCons prefer the MinGW tool chain

> by:

> import os

> env = Environment(ENV = {'PATH':os.environ['PATH']})

> Tool('mingw')(env)

> env.Program('test',['main.cpp','linalg.cpp'])

>

> Well, SCons went trying to invoke g++ but it did so with a

> Microsoft-specific option which makes g++ fail:

> scons: Reading SConscript files ...

> scons: done reading SConscript files.

> scons: Building targets ...

> g++ -o linalg.o -c /nologo linalg.cpp

> g++: error: /nologo: No such file or directory

> scons: *** [linalg.o] Error 1

> scons: building terminated because of errors.

>

> Is there a way of making it work WITHOUT having to hard-code MinGW

> into SConstruct? This would kind of defeat the purpose of SCons,

> wouldn't it?


Are you wishing to use Visual studio if there, and then mingw if no VC?
Or do you want to use only mingw if you're compiling on windows?

Are you running this from within cygwin? Or other shell?

-Bill


More information about the Scons-users mailing list