Scons 不使用我的环境变量,例如 PATH 和 LD_LIBRARY_PATH

Scons doesn't use my environment variables such as PATH and LD_LIBRARY_PATH

我有个小问题。

我获取了一个脚本来更改我的 RedHat 环境(PATH,LD_LIBRARY_PATH,etc.i)。

当我使用 scons 启动安装时,它会从我的机器中收取默认环境,但不会收取我加载的电流...

试了好几次,都没有定论。网上的大部分答案都与必须在 SConstruct 中设置的一个变量的变化有关。

如何让 scons 对当前环境收费,而不是对默认环境收费?

提前致谢!

经过更多搜索已经找到解决方案:env = Environment(ENV = os.environ)

SCons 的方法是在您的 SConstruct/SConscripts 中设置这些环境变量,这样每个用户最终都会得到一个可重现的构建环境。

阅读常见问题解答:http://scons.org/faq.html#Why_doesn.27t_SCons_find_my_compiler.2BAC8-linker.2BAC8-etc..3F_I_can_execute_it_just_fine_from_the_command_line

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.