[SERVER-77161] server fails to build with macosx 13.3 sdk Created: 15/May/23  Updated: 14/Jun/23  Resolved: 14/Jun/23

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

Type: New Feature Priority: Major - P3
Reporter: Daniel Moody Assignee: Backlog - Query Execution
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-77007 MongoDB fails to compile with Clang 1... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

This seems to be the latest SDK as of creation of this ticket. When using this SDK to build (on arm or x86 macos), errors will be produced similar too:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:540:52: error: arithmetic on a pointer to an incomplete type 'mongo::Value'
        {return static_cast<size_type>(__end_cap() - this->__begin_);}
                                       ~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:760:56: note: in instantiation of member function 'std::vector<mongo::Value>::capacity' requested here
      __annotate_contiguous_container(data(), data() + capacity(),
                                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:431:7: note: in instantiation of member function 'std::vector<mongo::Value>::__annotate_delete' requested here
      __annotate_delete();
      ^
src/mongo/db/exec/document_value/value_internal.h:121:5: note: in instantiation of member function 'std::vector<mongo::Value>::~vector' requested here
    RCVector() {}
    ^
src/mongo/db/exec/document_value/value_internal.h:54:7: note: forward declaration of 'mongo::Value'
class Value;
      ^
In file included from src/mongo/client/remote_command_retry_scheduler.cpp:34:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:760:54: error: arithmetic on a pointer to an incomplete type 'const std::vector<mongo::Value>::value_type' (aka 'const mongo::Value')
      __annotate_contiguous_container(data(), data() + capacity(),
                                              ~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:431:7: note: in instantiation of member function 'std::vector<mongo::Value>::__annotate_delete' requested here
      __annotate_delete();
      ^
src/mongo/db/exec/document_value/value_internal.h:121:5: note: in instantiation of member function 'std::vector<mongo::Value>::~vector' requested here
    RCVector() {}
    ^
src/mongo/db/exec/document_value/value_internal.h:54:7: note: forward declaration of 'mongo::Value'
class Value;
      ^
In file included from src/mongo/client/remote_command_retry_scheduler.cpp:34:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:833:64: error: arithmetic on a pointer to an incomplete type 'mongo::Value'
        __alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__soon_to_be_end));
                                                               ^ ~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:827:29: note: in instantiation of member function 'std::vector<mongo::Value>::__base_destruct_at_end' requested here
  void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);}
                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:436:9: note: in instantiation of member function 'std::vector<mongo::Value>::__clear' requested here
        __clear();
        ^
src/mongo/db/exec/document_value/value_internal.h:121:5: note: in instantiation of member function 'std::vector<mongo::Value>::~vector' requested here
    RCVector() {}
    ^
src/mongo/db/exec/document_value/value_internal.h:54:7: note: forward declaration of 'mongo::Value'
class Value;
      ^
In file included from src/mongo/client/remote_command_retry_scheduler.cpp:32:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:1712:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:848:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/allocator.h:128:58: error: invalid application of 'sizeof' to an incomplete type 'mongo::Value'
            _VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
                                                         ^~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/allocator_traits.h:282:13: note: in instantiation of member function 'std::allocator<mongo::Value>::deallocate' requested here
        __a.deallocate(__p, __n);
            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:437:25: note: in instantiation of member function 'std::allocator_traits<std::allocator<mongo::Value>>::deallocate' requested here
        __alloc_traits::deallocate(__alloc(), this->__begin_, capacity());
                        ^
src/mongo/db/exec/document_value/value_internal.h:121:5: note: in instantiation of member function 'std::vector<mongo::Value>::~vector' requested here
    RCVector() {}
    ^
src/mongo/db/exec/document_value/value_internal.h:54:7: note: forward declaration of 'mongo::Value'
class Value;
      ^ 

Among many others pointing into the SDK.

 

Workaround:
Install older SDK 12.1 or 13.1 and point to them by modifying the etc/scons/xcode_macosx_arm.vars or etc/scons/xcode_macosx.vars file to point to the target SDK: 

# this selects the latest SDK, but we want a older version
#sdk_path = subprocess.check_output(['xcrun', '--sdk', 'macosx', '--show-sdk-path']).decode('utf-8').strip() 
 
# This selects 13.1
sdk_path = subprocess.check_output(['xcrun', '--sdk', 'macosx13.1', '--show-sdk-path']).decode('utf-8').strip()



 Comments   
Comment by Kyle Suarez [ 14/Jun/23 ]

We won't choose to fix this unless it's actually impacting an officially-supported production build.

Comment by Alex Neben [ 16/May/23 ]

Assigning it to the same team as https://jira.mongodb.org/browse/SERVER-77007

Generated at Thu Feb 08 06:34:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.