Reputation: 46324
First off I should forewarn you that I am a new grad(and EE at that), and not terribly familiar a build process more advanced than my hello world programs.
My issue is: We are attempting to use SCons ton build our project at work. Our compiler is called 'i686-pc-elf-gcc' and uses posix style command line arguments. But whenever I try and use scons it forces Windows arguments, so instead of:
i686-pc-elf-gcc -o hello.o -c hello.cpp
I get
i686-pc-elf-gcc /Fohello.obj /c hello.cpp /TP /nologo
Which our compiler doesn't like. Here is what my SConscript file looks like
import os
path = ['c:\\compiler\GCC\i686\bin',
'../../build/include']
env = Environment(ENV = {'PATH' : path,'TEMP' : os.environ['TEMP']})
env.Replace(CC = "i686-pc-elf-gcc")
env['platform'] = 'posix'
env.Program('hello.cpp')
The environment is in a DOS prompt with cygwin installed. I was hoping setting the platform to posix was all that was needed, but I have been beating my head against the wall with no results.
Upvotes: 4
Views: 759
Reputation: 56438
Looks like the default SCons compiler detection is picking up the Microsoft compiler suite. Instead of:
env = Environment(ENV = {'PATH' : path,'TEMP' : os.environ['TEMP']})
maybe try:
env = Environment(tools = ['gcc', 'g++', 'gnulink'],
ENV = {'PATH' : path,'TEMP' : os.environ['TEMP']})
This way it will use the gcc toolset instead of the msvc one. If you only overwrite CC then all the flags are still MSVC style, while the compiler is really GNU. So the full SConstruct would be:
import os
path = [r'c:\compiler\GCC\i686\bin', '../../build/include']
env = Environment(tools = ['gcc', 'g++', 'gnulink'],
ENV = {'PATH' : path,'TEMP' : os.environ['TEMP']})
env.Replace(CC = "i686-pc-elf-gcc")
env.Program('hello.cpp')
Upvotes: 4