Skip to content

build: correctly detect clang version

Pull Request check-list

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with this change (including linting)? Yes
  • Is the commit message formatted according to CONTRIBUTING.md? Yes
  • If this change fixes a bug (or a performance problem), is a regression test (or a benchmark) included? n/a
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? n/a

Affected core subsystem(s)

build

Description of change

We provide our own build system on top of OpenSSL's, part of which is responsible for detecting support for newer assembly instructions (AVX2, etc). The optimized assembly is located in the deps/openssl/asm folder, whereas the fallback path is in deps/openssl/asm_obsolete.

The configuration script relies on scraping "cc -v" to obtain the LLVM version number on Mac OS X. However, as of Xcode 7 this information is no longer included in the banner, see here for a history of the banners: https://gist.github.com/yamaya/2924292

As a result, on systems with Xcode 7 OpenSSL will be compiled with the obsolete assembly path, regardless of actual hardware capability. I've resolved this issue by separately checking for the Xcode version. Note that there doesn't seem to be a way of obtaining the LLVM version, other than manually encoding it in a table such as this https://en.wikipedia.org/wiki/Xcode#Version_comparison_table. Storing this information is not reasonable for the config script, so verifying the Xcode version is a better way.

Note that both the get_llvm_version and get_xcode_version functions rely on minimum versions to return a match. Please see here for more details: https://github.com/nodejs/node/issues/5550#issuecomment-191968283

I've tested this change on Ubuntu 14.04 and Mac OS 10.11.3.

Merge request reports

Loading