Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear scons cache? CheckLibWithHeader returns "no" first time called, "yes" second time

Tags:

scons

I have a SConstruct file that is checking for the Google protobuf library, like so:

main['HAVE_PROTOBUF'] = main['PROTOC'] and \
conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h',
                        'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;')

I noticed that this call to CheckLibWithHeader was returning "no". I was doing some debugging of the script, and it became apparent to me that subsequent identical calls to CheckLibWithHeader returned "yes". When I put an identical line in the SConstruct file immediately following the one above, the output was as follows:

.
.
.
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
.
.
.

I do have the protobuf libraries. Does anyone know why the first call to CheckLibWithHeader is returning "no"?

This problem for me occurs in CentOS, but not in Ubuntu.

Update: I am no longer able to reproduce the above problem. However, I have found that when I run into a problem with scons using a value marked as "(cached)" that appears to be incorrect, I can do two things to help get to a solution. I'll put these in an answer below.

like image 659
plafratt Avatar asked Oct 07 '14 21:10

plafratt


2 Answers

The --config=force command line option should re-run all configuration tests without looking at the cached results. According to the man page for 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.
like image 61
crayzeewulf Avatar answered Nov 09 '22 11:11

crayzeewulf


I have found that when I run into a problem with scons using a value marked as "(cached)" that appears to be incorrect, I can do two things to help solve the problem.

  1. Check the "config.log" file, which shows what actions scons is actually taking when it is running its checks. This will provide hints as to why the check is failing.

  2. Delete the file ".sconsign.dblite" and the directory ".sconf_temp". This appears to clear out the scons cache, as during the following builds the "(cached)" markings don't appear.

like image 2
plafratt Avatar answered Nov 09 '22 11:11

plafratt