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

Add std=c++11 to CMakeLists for older compilers #1594

Closed
wants to merge 1 commit into from

Conversation

Armagetron
Copy link

@Armagetron Armagetron commented Feb 24, 2017

Compiling the library with older compilers like gcc 4.9 that do not compile the code with the C++11 standard by default may cause errors. Therefore I created this pull request that adds the C++11 standard explicitly.


This change is Reviewable

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@Armagetron
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@lararennie
Copy link
Contributor

Can you explain what problem this is fixing? We aren't expecting people to use c++11 compilers: are there parts of the code where c++11 has snuck in? You say "may cause errors" -> has it caused errors?

@Armagetron
Copy link
Author

I attached a build log I get when I compile the current version (master HEAD) on a Raspberry Pi with Raspbian Jessie and a gcc 4.9.2. With the fix I provided the error is gone.

I think this is caused by the protobuf compiler which generates C++11 code by default.

@lararennie
Copy link
Contributor

Thanks for more context!
Indeed, the latest version seems to require C++11 by default (protocolbuffers/protobuf#597)
However (this patch)[https://github.com/google/protobuf/commit/ffde972ac705e70f597267537b033d7c00ea54c5] seems to turn them off.

We should see if the latest protobuf version still has this problem: it seems they are considering branching and having a c++11 version and a non-c++11 version so they didn't intend to turn it on...

@Armagetron
Copy link
Author

I tested the current libphonenumber (1f69a99) together with the current protobuf (protocolbuffers/protobuf@f0a5c10) version with the gcc 4.9 I don't get any errors. So it works without c++11 again.

However if the protobuf team decides to move their future development to a c++11 based version, libphonenumber should probably go the same way so that the newest version can be used. A pre c++11 fork would only receive bug-fix support and on systems that ship the new version by default one would have to manage two versions.

@lararennie
Copy link
Contributor

Great to hear it works again!
It is a good point that the systems shipping the new version would have to manage two versions, but not everyone is ready to move to C++11 either, so we'd have to make such a move carefully and with input from our users.
I'll close this in the meantime as it's not needed right now. Thanks for following up!

@lararennie lararennie closed this Mar 14, 2017
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

Successfully merging this pull request may close these issues.

3 participants