Skip to content

Instantly share code, notes, and snippets.

@Daxx
Last active August 29, 2015 14:10
Show Gist options
  • Save Daxx/117b5279f41e1b299aad to your computer and use it in GitHub Desktop.
Save Daxx/117b5279f41e1b299aad to your computer and use it in GitHub Desktop.
shared.py uses "clang++ -v" but Ubuntu returns (e.g.) "Ubuntu clang version 3.3-16ubuntu1" rather than "clang version 3.3-16ubuntu1" which confuses the check and emits an unnecessary warning
--- /usr/share/emscripten/tools/shared_ORIG.py 2014-02-06 00:18:33.000000000
+++ /usr/share/emscripten/tools/shared.py 2014-11-21 02:58:05.000000000
@@ -274,19 +274,20 @@
actual_clang_version = None
def get_clang_version():
global actual_clang_version
if actual_clang_version is None:
- actual_clang_version = Popen([CLANG, '-v'], stderr=PIPE).communicate()[1].split('\n')[0].split(' ')[2]
+ mv = re.search(r'\s+[Vv]ersion\s+(\d+\.\d+)', Popen([CLANG, '-v'], stderr=PIPE).communicate()[1])
+ actual_clang_version = mv and mv.group(1)
return actual_clang_version
def check_clang_version():
expected = '.'.join(map(str, EXPECTED_LLVM_VERSION))
actual = get_clang_version()
- if expected in actual:
+ if actual and float(actual) >= float(expected):
return True
logging.warning('LLVM version appears incorrect (seeing "%s", expected "%s")' % (actual, expected))
return False
def check_llvm_version():
try:
@Daxx
Copy link
Author

Daxx commented Nov 21, 2014

$ emcc -v
WARNING root: LLVM version appears incorrect (seeing "version", expected "3.2")
INFO root: (Emscripten: Running sanity checks)
emcc (Emscripten GCC-like replacement + linker emulating GNU ld ) 1.10.0
Ubuntu clang version 3.3-16ubuntu1 (branches/release_33) (based on LLVM 3.3)
Target: x86_64-pc-linux-gnu
Thread model: posix

[In tools/shared.py] get_clang_version() is expecting (e.g) ...
"clang version 3.3-16ubuntu1"
but Ubuntu version returns ...
"Ubuntu clang version 3.3-16ubuntu1 ...", confusing the parser.
Yes, this might be Ubuntu's problem but I think the emscripten check might benefit from a change.

@Daxx
Copy link
Author

Daxx commented Nov 21, 2014

While searching, I found this Debian example which would prompt a similar warning if Debian still inserts their prefix ...
Debian clang version 3.0-6.2 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

@Daxx
Copy link
Author

Daxx commented Nov 21, 2014

... & Apple example ...
Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment