作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
遵循建议 on the Scons FAQ来自 old mailing list thread ,我已经建立了一个非常简单的 SConstruct
和 SConscript
我认为会构建一个示例应用程序,但出现错误:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
nios2-linux-gnu-g++ -o src/bin/example/example.o -c src/bin/example/example.cpp
sh: nios2-linux-gnu-g++: command not found
scons: *** [src/bin/example/example.o] Error 127
scons: building terminated because of errors.
SConstruct
文件:
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",
"PATH" : os.environ['PATH']
}
env = Environment(**env_options)
Export('env')
env.SConscript("src/bin/example/SConscript")
Import('env')
env.Program("example", ["example.cpp"])
env.Dump()
的相关部分(如果有什么遗漏,请告诉我):
{ 'AR': 'nios2-linux-gnu-ar',
'CC': 'nios2-linux-gnu-gcc',
'CCCOM': '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES',
'CCFLAGS': [],
'CCVERSION': '4.8.2',
'CFILESUFFIX': '.c',
'CFLAGS': [],
'CPPDEFPREFIX': '-D',
'CPPDEFSUFFIX': '',
'CPPSUFFIXES': [ '.c',
'.C',
'.cxx',
'.cpp',
'.c++',
'.cc',
'.h',
'.H',
'.hxx',
'.hpp',
'.hh',
'.F',
'.fpp',
'.FPP',
'.m',
'.mm',
'.S',
'.spp',
'.SPP',
'.sx'],
'CXX': 'nios2-linux-gnu-g++',
'CXXCOM': '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES',
'CXXFILESUFFIX': '.cc',
'CXXFLAGS': [],
'CXXVERSION': '4.8.2',
'HOST_ARCH': None,
'HOST_OS': None,
'PATH': '/home/chockey/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/chockey/bin/altera/13.1/quartus/bin:/home/chockey/bin/altera/13.1/quartus/sopc_builder/bin:/home/chockey/bin/altera/13.1/nios2eds/bin:/home/chockey/bin/altera/13.1/nios2eds/sdk2/bin:/home/chockey/bin/altera/13.1/nios2eds/bin/gnu/H-i686-pc-linux-gnu/bin',
'TOOLS': [ 'default',
'gnulink',
'gcc',
'g++',
'gfortran',
'gas',
'ar',
'filesystem',
'm4',
'lex',
'yacc',
'rpcgen',
'jar',
'javac',
'javah',
'rmic',
'dvipdf',
'gs',
'tar',
'zip'],
/home/chockey/bin/nios2-linux-gnu-addr2line@ /home/chockey/bin/nios2-linux-gnu-gcov@
/home/chockey/bin/nios2-linux-gnu-ar@ /home/chockey/bin/nios2-linux-gnu-gdb@
/home/chockey/bin/nios2-linux-gnu-as@ /home/chockey/bin/nios2-linux-gnu-gprof@
/home/chockey/bin/nios2-linux-gnu-c++@ /home/chockey/bin/nios2-linux-gnu-ld@
/home/chockey/bin/nios2-linux-gnu-c++filt@ /home/chockey/bin/nios2-linux-gnu-nm@
/home/chockey/bin/nios2-linux-gnu-cpp@ /home/chockey/bin/nios2-linux-gnu-objcopy@
/home/chockey/bin/nios2-linux-gnu-elfedit@ /home/chockey/bin/nios2-linux-gnu-objdump@
/home/chockey/bin/nios2-linux-gnu-g++@ /home/chockey/bin/nios2-linux-gnu-ranlib@
/home/chockey/bin/nios2-linux-gnu-gcc@ /home/chockey/bin/nios2-linux-gnu-readelf@
/home/chockey/bin/nios2-linux-gnu-gcc-4.7.3@ /home/chockey/bin/nios2-linux-gnu-size@
/home/chockey/bin/nios2-linux-gnu-gcc-ar@ /home/chockey/bin/nios2-linux-gnu-sprite@
/home/chockey/bin/nios2-linux-gnu-gcc-nm@ /home/chockey/bin/nios2-linux-gnu-strings@
/home/chockey/bin/nios2-linux-gnu-gcc-ranlib@ /home/chockey/bin/nios2-linux-gnu-strip@
最佳答案
您快到了。您正在添加您的 PATH
到 SCons 构建环境而不是 ENV
施工环境关键:
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')
关于cross-compiling - 如何将交叉编译器与 Scons 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23898584/
我是一名优秀的程序员,十分优秀!