How can I use a cross compiler with Scons?

You’re almost there. You’re adding your PATH to the SCons construction environment instead of to the ENV key of the construction environment:

import os

env_options = {
    "CC"    : "nios2-linux-gnu-gcc",
    "CXX"   : "nios2-linux-gnu-g++",
    "LD"    : "nios2-linux-gnu-g++",
    "AR"    : "nios2-linux-gnu-ar",
    "STRIP" : "nios2-linux-gnu-strip",
}

env = Environment(**env_options)
env.Append(ENV = {'PATH' : os.environ['PATH']})
Export('env')

Leave a Comment