[SERVER-19353] Compilation failure with GCC 5.1 Created: 10/Jul/15 Updated: 14/Apr/16 Resolved: 22/Sep/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Alexander Gorrod | Assignee: | Alexander Gorrod |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Backport Completed: | |
| Steps To Reproduce: | Install GCC 5.1 on Fedora 22. $ git clone https://github.com/mongodb/mongo.git |
| Sprint: | Platform 6 07/17/15 |
| Participants: |
| Description |
|
When I build with gcc 5.1 (default GCC on Fedora 22), I see warnings from the boost library. My particular compiler version:
The build warnings are:
|
| Comments |
| Comment by Alexander Gorrod [ 22/Sep/15 ] | |||||||||||||||
|
This is harder than I'd hoped. Fixing the unused variable warning, I see another error:
That one is out of my C++ knowledge. I'm going to close this issue for now. Can be revisited once we decide to officially support GCC 5.1 | |||||||||||||||
| Comment by Andrew Morrow (Inactive) [ 15/Jul/15 ] | |||||||||||||||
|
Static initializers are thread safe in C++11, but not yet on all of our supported compilers unfortunately. However, I don't think that is really the issue here. The compiler warning is actually correct: the variable isn't used, and this isn't a warning we want to disable. I suspect that GCC 5 has just expanded the scope of detection for this class of warning. The solution is probably to attach MONGO_COMPILER_VARIABLE_UNUSED. Please note though that GCC 5 is not yet a supported compiler. My recommendation is that you either build with the --disable-warnings-as-errors flag, or, if it is really a problem for you, make the patch to attach the unused macro and send a code review, which I'll be happy to approve. | |||||||||||||||
| Comment by Alexander Gorrod [ 13/Jul/15 ] | |||||||||||||||
|
Thanks acm that change helps significantly. I still see the second warning:
According to this article (http://stackoverflow.com/questions/18542804/global-static-initialization-threading) static initializers are thread safe in C++11, so maybe the code is redundant now? | |||||||||||||||
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: (cherry picked from commit 55af30c1040e346e09dbf6b3aa496a241685dc78) | |||||||||||||||
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: | |||||||||||||||
| Comment by Andrew Morrow (Inactive) [ 10/Jul/15 ] | |||||||||||||||
|
You can work around this by building with --disable-warnings-as-errors, however, this is a nuisance. I took a closer look at this, and I think we can fix this, permanently, by appending BOOST_SYSTEM_NO_DEPRECATED to our defines. agorrod - could you see if applying the following to the top level SConstruct makes this go away for you (without specifying --disable-warnings-as-errors):
| |||||||||||||||
| Comment by Alexander Gorrod [ 10/Jul/15 ] | |||||||||||||||
|
I do see one other error as well - though only if I specify a parallel build:
As another point of reference I can build without warnings on my Ubuntu box that has GCC 4.8.2. | |||||||||||||||
| Comment by Andy Schwerin [ 10/Jul/15 ] | |||||||||||||||
|
Those errors may be a symptom. On earlier compilers, I think those are the last errors to appear sometimes when something else in the translation unit stops the compiler. Are those the first errors for the unit? If -j is large, sometimes the first error is hundreds of lines up in the build log. | |||||||||||||||
| Comment by Alexander Gorrod [ 10/Jul/15 ] | |||||||||||||||
|
I can work around this problem by passing the following flags to scons:
|