[SERVER-60263] stitch_support library fails to load due to missing static initializers Created: 27/Sep/21  Updated: 29/Oct/23  Resolved: 07/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0, 5.0.4, 5.1.0-rc1

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Daniel Moody
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1, v5.0
Steps To Reproduce:

1. Save

#include "stitch_support/stitch_support.h"
#include <cassert>
 
int main() {
    auto status = stitch_support_v1_status_create();
    assert(status != nullptr);
 
    auto lib = stitch_support_v1_init(status);
    assert(lib != nullptr);
 
    return 0;
}

2. g++ -I build/install/include/stitch_support/v1 stitch.cpp -L build/install/lib/ -lstitch_support

3. LD_LIBRARY_PATH=build/install/lib/ gdb ./a.out
a.out should return 0 instead of asserting

Sprint: Dev Platform 2021-10-18
Participants:

 Description   

The link-model "dynamic-sdk" is linking archives but by default object files in archives are not included unless they are needed.

The specific issue in this case is that https://github.com/mongodb/mongo/blob/master/src/mongo/util/options_parser/startup_option_init.cpp is missing from the final library.



 Comments   
Comment by Githook User [ 18/Oct/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-60263 switch dynamic-sdk link-model to use whole-archive for initializers

(cherry picked from commit 8aef619d2368bb802aa5f109bffbbb916c0aa357)
Branch: v5.0
https://github.com/mongodb/mongo/commit/f457bc341e85197c6d0f1ac335f3beb42510db35

Comment by Githook User [ 18/Oct/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-60263 switch dynamic-sdk link-model to use whole-archive for initializers

(cherry picked from commit 8aef619d2368bb802aa5f109bffbbb916c0aa357)
Branch: v5.1
https://github.com/mongodb/mongo/commit/6b406da5f066f6c69478f7934cdb83c0fa5ca7cd

Comment by Githook User [ 07/Oct/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-60263 switch dynamic-sdk link-model to use whole-archive for initializers
Branch: master
https://github.com/mongodb/mongo/commit/8aef619d2368bb802aa5f109bffbbb916c0aa357

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