Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use higher version c++ #16501

Closed
wants to merge 3 commits into from

Conversation

refack
Copy link
Contributor

@refack refack commented Oct 25, 2017

Use c++14 on all Windows and clang using platforms
Use c++11 on all GCC using platforms

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

build

@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Oct 25, 2017
@addaleax
Copy link
Member

I guess my main question here would be, what’s the motivation for this? We’re still stuck with C++11 for now, and c++0x is essentially just a more-widely-supported alias for c++11 (unless I am mistaken about that)?

@refack
Copy link
Contributor Author

refack commented Oct 25, 2017

https://ci.nodejs.org/job/node-test-commit/13465/

/cc @nodejs/build @nodejs/platform-freebsd
Seems like the only failing platform is freebsd10

@refack
Copy link
Contributor Author

refack commented Oct 25, 2017

I guess my main question here would be, what’s the motivation for this?

@targos and V8 I assume - nodejs/build#945

@addaleax
Copy link
Member

@targos
Copy link
Member

targos commented Oct 26, 2017

@addaleax It doesn't :(

CI results:

  • OSX with gnu++11: fail
  • OSX with gnu++14: pass

I think we should align with V8 as much as possible. Luckily, their constraints are very similar to ours: they can use C++14 features if it compiles in GCC 4.8.

common.gypi Outdated
'cflags_cc': [ '-std=c++14' ],
}, {
'cflags_cc': [ '-std=gnu++11' ],
}],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe keep that for FreeBSD since mac seems to ignore it

@@ -10,7 +10,9 @@
'component%': 'static_library', # NB. these names match with what V8 expects
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
'python%': 'python',

'gas_version%': 0,
'llvm_version%': 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a variable set in the configure script when clang is detected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. The configure script wasn't modified in this PR. How come these two lines weren't necessary before?

Copy link
Contributor Author

@refack refack Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to check llvm_version version (without first doing "feature detection"), we need these vars with default value (90f055f).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S. It not necessary in the current changeset, so I could move this to a new PR

@@ -211,6 +214,9 @@
# and their sheer number drowns out other, more legitimate warnings.
'DisableSpecificWarnings': ['4267'],
'WarnAsError': 'false',
'AdditionalOptions': [
'/std:c++14'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary, both VS2015 and VS2015 default to /std:c++14.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have this (1) for being explicit (2) for future proofing, in case the default changes to C++17 or higher

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

Use c++11 on all GCC using platforms

Why C++11 if C++14 is necessary for V8?

@targos
Copy link
Member

targos commented Oct 26, 2017

because GCC 4.8 does not support C++14 and our build infra is still on this version.

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

If this doesn't solve the V8 problem, then what's the point?

@targos
Copy link
Member

targos commented Oct 26, 2017

The V8 problem is with Clang. To fix it we need -std=gnu++14 in this compiler.
We can keep -std=gnu++0x in GCC if the change feels unnecessary.

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

I'm -1 on using different C++ versions on clang and gcc. Since gcc supports -std=c++14 since 5.2 (source), I suggest using either gnu++1y or c++1y for both.

@bnoordhuis
Copy link
Member

because GCC 4.8 does not support C++14 and our build infra is still on this version.

Then wouldn't it make sense to upgrade to 4.9 and stop using 4.8?

@targos
Copy link
Member

targos commented Oct 26, 2017

@bnoordhuis I agree, but that seems like a non-trivial thing to do now: nodejs/build#945 (comment)

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

Then wouldn't it make sense to upgrade to 4.9 and stop using 4.8?

Sure would. I've been trying to help with that, but it's been stuck on Ubuntu 14.04 and CentOS 6 for the last 3 months: nodejs/build#797, nodejs/build#809

@targos
Copy link
Member

targos commented Oct 26, 2017

Canary build with -std=gnu++1y: https://ci.nodejs.org/job/node-test-commit/13482/

@addaleax
Copy link
Member

Just to make sure I’m understanding this correctly: The purpose of this patch is to fix a compile error in V8 that happens only with clang and for which bumping to -std=c++14 is the fix that the V8 team would prefer?

@targos
Copy link
Member

targos commented Oct 26, 2017

@addaleax Yes. the main goal is to fix a compile error. The secondary is to build with a configuration closer to what the V8 team has to prevent errors in the future.

@addaleax
Copy link
Member

@targos Thanks, that is the information I was looking for.

I kind of agree with @seishun’s sentiment that it’s a bad idea to have some people running C++14 and some people running C++11. I think upgrading to a requirement of C++14 (as gnu++1y?) for everyone is a good idea if we can get away with it, but I’d also consider that a semver-major change.

@targos
Copy link
Member

targos commented Oct 26, 2017

I'm OK with semver-major. I can float the commit in canary until we need it.

@jasnell
Copy link
Member

jasnell commented Oct 26, 2017

I'm a bit reluctant on this but as long as it's semver-major then ok

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

I fail to see how this is semver-major.

@bnoordhuis
Copy link
Member

bnoordhuis commented Oct 26, 2017

It is unless we take care to ensure that the build keeps working with older libstdc++ versions (ref.)

More precisely, we need to ensure that it doesn't stop working with missing foo@GLIBCXX_3.4.20 errors in a patch or minor release.

edit: https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for details.

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

I'm pretty sure none of that has anything to do with the -std= option.

@bnoordhuis
Copy link
Member

You'd be surprised. The language level and the standard library go hand in hand. At least, on Linux they do.

@seishun
Copy link
Contributor

seishun commented Oct 26, 2017

I'd love to see some reference for that.

@refack
Copy link
Contributor Author

refack commented Oct 26, 2017

  1. IMHO semver-ness could be patch since we already landed

    node/configure

    Line 657 in 75f1087

    warn('C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=%s)' % CXX)

    * GCC 4.9.4 or newer
  2. I'm blocking this till we have C++14 enabled compilers on the build infra

@refack refack self-assigned this Oct 26, 2017
@refack refack added the blocked PRs that are blocked by other issues or PRs. label Oct 26, 2017
@targos
Copy link
Member

targos commented Jan 15, 2018

@refack may I suggest we close this? There is a commit in #17489 to update the config to -std=gnu++1y and that PR is semver-major.

@BridgeAR
Copy link
Member

Closing as suggested. @refack please reopen if you feel differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked PRs that are blocked by other issues or PRs. build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants