I am trying to create the simplest imaginable SConstruct file for cross-compiling a program. I tried different settings, the last SConstruct file is here:
env_options = { "CC" : "arm-linux-gnueabihf-gcc", "CXX" : "arm-linux-gnueabihf-g++", "LD" : "arm-linux-gnueabihf-ld", "AR" : "arm-linux-gnueabihf-ar", "STRIP" : "arm-linux-gnueabihf-strip" } env = Environment(**env_options) path = ['/path/to/toolchain/bin/'] env.Append( ENV = {'PATH' : path}) p = Program( "prog", [ "prog.c", "mylib.c" ], CFLAGS=[ '-Iinclude', '-Werror', '-Wall', '-Wextra' ] )
The output of env.Dump() shows, for example:
{ 'AR': 'arm-linux-gnueabihf-ar', 'CC': 'arm-linux-gnueabihf-gcc', 'CXX': 'arm-linux-gnueabihf-g++', 'ENV': { 'PATH': [ '/path/to/toolchain/bin/']}, 'LD': 'arm-linux-gnueabihf-ld', 'TOOLS': [ 'default', 'gnulink', 'gcc', 'g++', 'gas', 'ar', 'filesystem', 'm4', 'zip'] }
I do not see any surprises in the output of env.Dump() (especially without standard system paths), and thought that if scons could not find the tools listed in env_options , I would at least get an error message. Instead, scons uses the default tools and creates a program for my host system. I reviewed the answers posted here (1) and here (2) - so far without success.
- What am I missing?
- How is it possible that scons still finds and uses the default tools (I explicitly stated that I should use the
arm-linux-gnueabihf-gcc-4.8.3 binary and there are no system paths in ENV like /bin/ or /usr/bin defined in ENV)? - How can I make scons explicitly use only the paths / tools that I go through (create an environment from scratch)?