Skip to content

Why do we pass "-std=gnu++0x" to the compiler? #945

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

Closed
targos opened this issue Oct 25, 2017 · 16 comments
Closed

Why do we pass "-std=gnu++0x" to the compiler? #945

targos opened this issue Oct 25, 2017 · 16 comments

Comments

@targos
Copy link
Member

targos commented Oct 25, 2017

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/728026#message-a337cd5c8611b2408a8972deb3d20528b5845be1

It seems that we should pass -std=gnu++11 at least. Unless we support compilers that don't have this option?

@targos
Copy link
Member Author

targos commented Oct 25, 2017

-std=gnu++14 would be even better and Clang supports it since version 3.4: https://clang.llvm.org/cxx_status.html

@targos
Copy link
Member Author

targos commented Oct 25, 2017

Ref: nodejs/node@e43c109891d

I'm going to try and change this option to see if CI can pass.

@targos
Copy link
Member Author

targos commented Oct 25, 2017

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

I already see that LinuxONE does not support it.

@targos
Copy link
Member Author

targos commented Oct 25, 2017

/cc @nodejs/build and @nodejs/v8

@gibfahn
Copy link
Member

gibfahn commented Oct 25, 2017

cc/ @joransiu @jBarz

@targos
Copy link
Member Author

targos commented Oct 25, 2017

So, by looking at this build, I see that we are still compiling with GCC 4.8. but we officially stopped to support it for Node 8.

New CI with -std=gnu++11: https://ci.nodejs.org/job/node-test-commit/13447/

Edit: GCC 4.8 does not support C++14. I don't know if 4.9 does.

@targos
Copy link
Member Author

targos commented Oct 25, 2017

/cc @bnoordhuis

@refack
Copy link
Contributor

refack commented Oct 25, 2017

RE migration to a newer version: we're trying to balance the new requirements (GCC 4.9 for example is a "soft" requirement) and still keeping the old configuration for LTS node versions.
Refs: #809
Refs: #797

  1. Some old platforms (CentOS5 & 6) don't have well supported binaries of newer GCC.
  2. changing the global GCC changes the global stdlib++ which requires the users to upgrade, so we're trying figure out way to either have it side-by-side, or have multiple build-bots
  3. getting prebuilt toolschains for 32bit environments is also a challenge. Dropping 32-bit builds #885

@targos
Copy link
Member Author

targos commented Oct 25, 2017

From https://chromium-review.googlesource.com/c/v8/v8/+/728026#message-697b6bb5ae15281bdd7c9b457aa75b75ef8a14ea:

C++14 is generally allowed in chromium (https://chromium-cpp.appspot.com/), hence also in V8. The only restriction is that it has to compile in GCC 4.8 (and all the other compilers we use on the bots). GCC 4.8 only supports C++11, so all code used by this compiler has to compile with c++11.

If CI is green, I'll start a new run with -std=gnu++11 with the canary branch. If it is still green, I'll submit a PR to core.

@targos
Copy link
Member Author

targos commented Oct 25, 2017

Canary build: https://ci.nodejs.org/view/MyJobs/job/node-test-commit-node-v8/193/

Edit: that obviously does not work :(

@targos
Copy link
Member Author

targos commented Oct 25, 2017

It's looking good on osx with -std=gnu++14.

Here is a proposition that should work:

  • Build with -std=gnu++11 in GCC
  • Build with -std=gnu++14 in LLVM (including osx and freebsd)

@refack do you think it's possible to modify common.gypi do achieve that?

@refack
Copy link
Contributor

refack commented Oct 25, 2017

@refack do you think it's possible to modify common.gypi do achieve that?

Yep, I'll make a PR

@refack
Copy link
Contributor

refack commented Oct 25, 2017

refack/node@master...higher-c++-ver-by-default

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

For now I see that freebsd10 is not happy - error: invalid value 'c++14' in '-std=c++14'

@bnoordhuis
Copy link
Member

changing the global GCC changes the global stdlib++

Right, that might be a problem. Technically it already matters if you compile with 4.8.2 or 4.8.3 (libstdc++ 6.0.18 vs. 6.0.19; 4.9 is 6.0.20) but yeah.

@fhinkel
Copy link
Member

fhinkel commented Jan 15, 2018

I know this is closed already, but I would very much like it if we could go up to GCC 4.9. We can't use a bunch of C++14 feature in V8, because then Node wouldn't compile anymore with 4.8.

@targos
Copy link
Member Author

targos commented Jan 15, 2018

@fhinkel do you mind opening a new issue? IMO It's important that we arrive to a conclusion before the release of Node 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants