On Thu, Jul 27, 2017 at 3:34 PM, Thiago Macieira <[email protected]>
wrote:

> On Thursday, 27 July 2017 13:24:16 PDT Nash, George wrote:
> > Its due to a single design decision.  SCons throws away all environment
> > variables.  You must explicitly import the environment variables inside
> > SCons. Which we do for things like JAVA_HOME.  The idea is that by
> > isolating the scons from the environment variables you reduce the "it
> works
> > on my system" situations that result from environment variables that
> exist
> > on one system and not the other.  This also means throwing out everything
> > set by vcvarsall.bat script.
> >
> > You can manually modify scons to import PATH but vcarsall.bat does more
> than
> > just add cl.exe to the PATH. So scons will typically still have problems
> > finding some headers and such.
>
> That's still somewhat stupid. It must obey the environment, especially
> PATH.
> Where is it going to find the compiler in the first place, even on Unix
> systems?
>
> Also, even GCC does have support for environment variables. Setting
> LD_LIBRARY_PATH is actually VERY common and may be required by the
> toolchain
> that the user installed.
>
> Overriding those and performing guesswork is stupid and far more likely to
> cause problems.
>

Easy enough to fix, I expect:

" *scons* does not automatically propagate the external environment used to
execute *scons* to the commands used to build target files. This is so that
builds will be guaranteed repeatable regardless of the environment
variables set at the time *scons* is invoked. This also means that if the
compiler or other commands that you want to use to build your target files
are not in standard system locations, *scons* will not find them unless you
explicitly set the PATH to include those locations. Whenever you create an
*scons* construction environment, you can propagate the value of PATH from
your external environment as follows:

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

Similarly, if the commands use external environment variables like $PATH,
$HOME, $JAVA_HOME, $LANG, $SHELL, $TERM, etc., these variables can also be
explicitly propagated:

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

Or you may explicitly propagate the invoking user's complete external
environment:

import os
env = Environment(ENV = os.environ)

This comes at the expense of making your build dependent on the user's
environment being set correctly, but it may be more convenient for many
configurations.

>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> iotivity-dev mailing list
> [email protected]
> https://lists.iotivity.org/mailman/listinfo/iotivity-dev
>
_______________________________________________
iotivity-dev mailing list
[email protected]
https://lists.iotivity.org/mailman/listinfo/iotivity-dev

Reply via email to