aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-08-30 16:42:34 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-08-30 16:42:34 -0700
commit94a0cb1ccd753d834db0d82ffaf32a13712641d1 (patch)
tree570d18637c1aa9a2aeb85eeb327d7676804d99a6
parent2667b5806edcab3043ca3f58f6408158ff6dfd47 (diff)
--clear-cache option
-rwxr-xr-xemcc15
-rwxr-xr-xtests/runner.py7
2 files changed, 22 insertions, 0 deletions
diff --git a/emcc b/emcc
index ace14ece..aa8827da 100755
--- a/emcc
+++ b/emcc
@@ -285,6 +285,17 @@ Options that are modified or new in %s include:
llvm-link's behavior is not as permissive
as ld is.
+ --clear-cache Manually clears the cache of compiled
+ emscripten system libraries (libc++,
+ libc++abi, dlmalloc). This is normally
+ handled automatically, but if you update
+ llvm in-place (instead of having a different
+ directory for a new version), the caching
+ mechanism can get confused. Clearing the
+ cache can fix weird problems related to
+ cache incompatibilities, like clang failing
+ to link with library files.
+
The target file, if specified (-o <target>), defines what will
be generated:
@@ -519,6 +530,10 @@ try:
elif newargs[i] == '--remove-duplicates':
remove_duplicates = True
newargs[i] = ''
+ elif newargs[i] == '--clear-cache':
+ newargs[i] = ''
+ print >> sys.stderr, 'emcc: clearing cache'
+ shared.Cache.erase()
elif newargs[i].startswith(('-I/', '-L/')):
print >> sys.stderr, 'emcc: warning: -I or -L of an absolute path encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)' # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not
newargs = [ arg for arg in newargs if arg is not '' ]
diff --git a/tests/runner.py b/tests/runner.py
index a11928e1..54ae5a49 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -8803,6 +8803,7 @@ elif 'sanity' in str(sys.argv):
def test_emcc_caching(self):
INCLUDING_MESSAGE = 'emcc: including X'
BUILDING_MESSAGE = 'emcc: building X for cache'
+ ERASING_MESSAGE = 'emcc: clearing cache'
EMCC_CACHE = Cache.dirname
@@ -8850,6 +8851,12 @@ elif 'sanity' in str(sys.argv):
if emcc_debug:
os.environ['EMCC_DEBUG'] = emcc_debug
+ # Manual cache clearing
+ assert os.path.exists(EMCC_CACHE)
+ output = self.do([EMCC, '--clear-cache'])
+ assert ERASING_MESSAGE in output
+ assert not os.path.exists(EMCC_CACHE)
+
else:
raise Exception('Test runner is confused: ' + str(sys.argv))