以下建议在使用SCons常见问题,并从旧邮件列表的线程,我已经建立了一个非常简单的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.
Run Code Online (Sandbox Code Playgroud)
啊。我的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")
Run Code Online (Sandbox Code Playgroud)
以及它调用的 SConscript:
Import('env')
env.Program("example", …Run Code Online (Sandbox Code Playgroud) 我最近安装了 mingw-w64 并尝试使用 SCons 构建程序。SConstruct这是我一直尝试使用的文件的示例:
env = Environment(tools = ['mingw'])
env.Program('test.c')
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
File "C:\Python27\Scripts\scons.py", line 199, in <module>
gcc -o test.o -c test.c
'gcc' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [test.o] Error 1
scons: building terminated because …Run Code Online (Sandbox Code Playgroud) 在我们的构建中,我们使用如下单元测试创建可执行文件:
tests = env.Program(os.path.join(env['testDir'], name + '_test'),
src + createManifest(env),
LIBS = libs,
LIBPATH = buildLibPath(env),
LINKFLAGS = env['LINKFLAGS'],
CPPPATH = cppPath)
Run Code Online (Sandbox Code Playgroud)
这正确地创建了一个可执行文件,以后由以下构建器运行:
action = tests[0].abspath + '&& echo %DATE% %TIME% > ${TARGET}'
runTests = env.Command(source = tests,
target = 'test_'+name+'.tmp',
action = action)
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切正常:测试正在构建期间运行.
我最近发现了Visual Leak Detector工具,并希望将其包含在构建中.所以,我改变了建设者的环境,如下所示:
vldInclude = os.path.join(os.path.normpath(env['vldIncDir']), 'vld.h')
env.Append(CPPFLAGS='/FI' + vldInclude)
env.Append(LIBPATH = env['vldLibDir'])
vldLib = os.path.join(env['vldLibDir'], 'vld.lib')
libs.append(vldLib) # used in the Program call for the LIBS parameter, see above
Run Code Online (Sandbox Code Playgroud)
scons:***[build\debug\libname\test_libname.dummy]错误309
此错误消息不是很有帮助.它是什么意思以及如何解决它?
我有一个相当大的 C++ 项目,由几个共享库和可执行文件组成。该项目由 SCons 构建。我的客户要求任何补丁都必须包含尽可能少的二进制文件。换句话说,我必须在构建之前知道要构建哪些目标。此外,如果 A.cpp 生成 libB.sl 进而影响 libC.sl 和 D.bin,我只需要获取 libB.sl 作为输出。我找不到简单的方法来做到这一点。有什么建议吗?
我正在玩c ++ 17和插件,我遇到了一个我无法解决的错误.在下面的MWE中,我可以调用一个带有a的本地函数,std::any当我尝试读取内容时,一切都按预期工作.当我通过插件(dlopen)加载这个完全相同的函数时,它正确地看到了any上的类型,但它不能std::any_cast是内容.
在弄清楚导致此错误的原因时,将非常感谢任何帮助.
这是我的环境,MWE和产生的错误.
>> g++ --version
g++ (GCC) 7.1.1 20170526 (Red Hat 7.1.1-2)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)
>> scons --version
SCons by Steven Knight et al.:
script: v2.5.1.rel_2.5.1:3735:9dc6cee5c168[MODIFIED], 2016/11/03 14:02:02, by bdbaddog on mongodog
engine: v2.5.1.rel_2.5.1:3735:9dc6cee5c168[MODIFIED], 2016/11/03 14:02:02, by bdbaddog on mongodog
engine path: ['/usr/lib/scons/SCons']
Copyright (c) …Run Code Online (Sandbox Code Playgroud) 我正在寻找适合我要求的测试框架.以下是我在自动化测试期间需要执行的步骤:
除此之外,我还希望有一些智能来确保.cc文件是否已更改,所有可以验证更改的测试都应该运行.
我正在评估PyUnit,cppunit与scons为此.考虑运行这个问题以确保我的方向正确.你能建议任何其他测试框架工具吗?选择正确的测试框架应该考虑哪些其他要求?
我正在尝试为我的类运行一个简单的OpenGL教程,但C++代码是为Windows和Linux运行的.我试图让它在Mac OS X Mountain Lion下运行.我找到了正确的库头,它现在编译好(使用scons),但是运行时构建会出现此错误:
dyld: Symbol not found: _jpeg_resync_to_restart
Referenced from: /usr/local/lib/libIL.1.dylib
Expected in: flat namespace
in /usr/local/lib/libIL.1.dylib
Trace/BPT trap: 5
Run Code Online (Sandbox Code Playgroud)
在线搜索只给我带来了python成像库问题.我通过自制软件安装了libjpeg和DevIL.
我已经完成了这里的scons构建示例,发现他们希望提供适合我项目的解决方案.
结构如下:
root/
Module_A/
include/
foo.h
bar.h
src/
foo.cpp
bar.cpp
Module_.../
Run Code Online (Sandbox Code Playgroud)
每个模块都遵循相同的结构,包括所有.h的include文件夹和cpps的src文件.每个模块构建为共享对象.没有可执行文件.
模块具有交叉依赖性.例如,Module_A是日志记录机制,它用于模块B,C,D等.同样,Module_B是配置加载程序,在其他几个模块中使用.Module_C将是IPC模块,几乎用于列出的每个模块.最后,Module_D是命令中心,并链接到每个其他模块(字面意思).
我有兴趣替换我们使用递归make来构建项目的当前设置.我正在尝试构建必要的sconstruct和SConscripts,但我甚至很新,甚至是scons.
我有兴趣将每个Module的.cpp和.h转换为.so并使其依赖关系自动解决,就像make now一样.
在SConscript中,我目前使用glob来获取*.cpps,然后在CPPPATH中包含模块的'./include'.我用过
env.SharedLibrary(CPPATH='./include', source= (list of the cpps))
但由于这取决于其他模块,它将无法工作,说明使用的其他模块的功能是"未声明".
如何使用分层scons设置来构建这种复杂的结构?
我使用scons编译vc10和瑞萨编译器.
是否有任何命令可以在调试模式下获取可执行文件?
如果我使用命令" scons并输入" 执行我的项目,它将进入释放模式.
我无法使用visual studio调试器调试该.exe文件.
谁能告诉我如何在调试模式下获得调试可执行文件?是否有任何命令或标志在scons中设置?
有谁知道scons何时会支持Visual Studio 2013?
最新版本2.3.1经过硬编码,可以查找6.0到11.0.但没有12.0的条目.
VS 2013已经发布了几个月.我很惊讶这是缺乏的.
谢谢谢恩