[SERVER-61433] Boost thread compilation warning with new glibc Created: 12/Nov/21  Updated: 25/May/22  Resolved: 16/Dec/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Andrew Morrow (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-59416 Upgrade vendored boost to 1.77.0 or n... Closed
duplicates SERVER-60440 Update boost to latest stable version Closed
Related
is related to SERVER-59459 mongodb fails to build with glibc-2.34 Closed
Operating System: ALL
Sprint: Dev Platform 2021-12-27
Participants:

 Description   

Building with the latest pthread headers produces a warning in Boost::Thread

In file included from src/third_party/boost/boost/thread/thread_only.hpp:17,
                 from src/third_party/boost/boost/thread/thread.hpp:12,
                 from src/third_party/boost/boost/log/sinks/async_frontend.hpp:38,
                 from src/third_party/boost/boost/log/sinks.hpp:25,
                 from src/mongo/shell/mongo_main.cpp:40:
src/third_party/boost/boost/thread/pthread/thread_data.hpp: In member function ‘void boost::thread_attributes::set_stack_size(std::size_t)’:
src/third_party/boost/boost/thread/pthread/thread_data.hpp:61:19: error: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Werror=sign-compare]
           if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;

This is due to the macro definition for PTHREAD_STACK_MIN changing from a numeric literal to a function call that returns a long int. This started failing for me when I upgraded to Fedora 35.

Workaround is to build with --disable-warnings-as-errors
Potential fixes include upgrading to a version of Boost::Thread with the fix; hacking our vendored Boost to avoid the warning; playing with macros like __USE_DYNAMIC_STACK_SIZE to avoid the problematic definition.



 Comments   
Comment by Andrew Morrow (Inactive) [ 16/Dec/21 ]

This appears to be fixed upstream in boost 1.78: https://github.com/boostorg/thread/commit/f9d0e594d43afcb4ab0043117249feb266ba4515#diff-ef2dff427736336b6cfc1b3e54c68a8c8321d7b1a69c551a6e6191afc7d783ee.

I'm going to close this as a dup of the boost upgrade ticket SERVER-59416.

Generated at Thu Feb 08 05:52:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.