我有一个SConstruct文件正在检查Google protobuf库,如下所示:
main['HAVE_PROTOBUF'] = main['PROTOC'] and \
conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h',
'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;')
Run Code Online (Sandbox Code Playgroud)
我注意到对CheckLibWithHeader的这个调用返回"否".我正在对脚本进行一些调试,对我来说很明显后来对CheckLibWithHeader的相同调用返回"是".当我在SConstruct文件中紧跟上面一行后放置一条相同的行时,输出如下:
.
.
.
Checking for accept(0,0,0) in C++ library None... (cached) yes
Checking for zlibVersion() in C++ library z... (cached) yes
Checking for GOOGLE_PROTOBUF_VERIFY_VERSION in C++ library protobuf... (cached) no
Checking for GOOGLE_PROTOBUF_VERIFY_VERSION in C++ library protobuf... (cached) yes
Checking for clock_nanosleep(0,0,NULL,NULL) in C library None... no
Checking for clock_nanosleep(0,0,NULL,NULL) in C library rt... yes
.
.
.
Run Code Online (Sandbox Code Playgroud)
我有protobuf库.有谁知道为什么第一次调用CheckLibWithHeader返回"否"?
对我来说这个问题发生在CentOS中,但不是在Ubuntu中.
更新:我不再能够重现上述问题.但是,我发现当我遇到scons使用标记为"(缓存)"的值的问题时,我觉得这可能是不正确的,我可以做两件事来帮助找到解决方案.我将把这些放在下面的答案中.
该--config=force命令行选项应该重新运行所有配置测试不看缓存的结果.根据SCons的手册页:
--config=force
If this option is specified, all configuration tests will be re-run
regardless of whether the cached results are out of date. This can
be used to explicitly force the configuration tests to be updated in
response to an otherwise unconfigured change in a system header file
or compiler.
Run Code Online (Sandbox Code Playgroud)