Ray*_*y2k 4 environment-variables cross-compiling scons scratchbox
我一直在使用带有基于Make的代码库的sbox而没有任何问题.现在我正在使用基于scons的代码库,并且遇到了一些奇怪的问题.
似乎在scratchbox中,scons找不到g ++.例如,它尝试执行以下操作:
你好hello.c
什么时候该做:
g ++ -o hello hello.c
所以可能它的g ++字符串变量是空的.g ++存在于PATH中 - "g ++"产生/ scratchbox/compilers/bin/g ++.
相同的源在scratchbox之外构建得很好,所以它不应该是scons或代码库的问题.工作时,没有在scratchbox之外设置的特殊环境变量.
如果我象征性地将/ usr/bin/g ++链接到/ scratchbox/compilers/bin/g ++,它会更进一步(产生正确的g ++命令)但是在执行它们时会产生:
sb_gcc_wrapper(g ++):/ scratchbox/compilers/arm-linux-cs2007q3-51sb3/bin/sbox-arm-none-linux-gnueabi-g ++:没有这样的文件或目录
列出的文件是存在.
PATH包含/ scratchbox/compilers/bin,SBOX_REDIRECT_FROM_DIRS包含/ usr/bin,SBOX_REDIRECT_TO_DIRS包含/ scratchbox/compilers/bin,所以我认为它应该能够找到它.
任何建议,将不胜感激!谢谢,雷
编辑:也许相关 - 除非我在scons文件中添加完整路径,否则它也找不到pkg-config
scons不传播PATH环境变量,所以测试例如'哪个g ++'没有多大帮助.
Either set the compilers directly, e.g.
env['CXX'] = '/scratchbox/compilers/bin/g++'
Run Code Online (Sandbox Code Playgroud)
构建自己的显式PATH
path = ['/scratchbox/compilers/bin/','/bin', '/usr/bin', '/sbin','/usr/sbin']
env = Environment(ENV = {'PATH' : path})
Run Code Online (Sandbox Code Playgroud)
或者使用shell中的PATH env变量
import os
env = Environment(ENV = {'PATH' : os.environ['PATH']})
Run Code Online (Sandbox Code Playgroud)