January 2018
Intermediate to advanced
456 pages
12h 49m
English
SCons parses SConstruct files, and by default it does not propagate the environment into the build system. This is to avoid build issues caused by environment differences. This is a complication for Yocto, as it configures the environment with cross-compilation toolchain settings. SCons does not define a standard way to support cross-compilation, so every project will implement it differently. For a simple example as the helloworld program, we can just initialize the CC, LINKFLAGS and PATH variables in our SConstruct file from the external environment as follows:
import os env = Environment(CC = os.environ['CC'], LINKFLAGS = os.environ['LDFLAGS'], ENV = {'PATH': os.environ['PATH']}) env.Program("helloworld", "helloworld.c") ...Read now
Unlock full access