[SERVER-34786] service_context_d is not an independently linkable library Created: 02/May/18  Updated: 14/May/18  Resolved: 02/May/18

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

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-29908 Libraries db/s/sharding and db/query/... Closed
Operating System: ALL
Participants:

 Description   

service_context_d is a library with some undefined references:

build/ninja/mongo/db/s/libsharding.so: error: undefined reference to 'mongo::ShardServerCatalogCacheLoader::ShardServerCatalogCacheLoader(std::unique_ptr<mongo::CatalogCacheLoader, std::default_delete<mongo::CatalogCacheLoader> >)'
build/ninja/mongo/db/s/libsharding.so: error: undefined reference to 'vtable for mongo::ReadOnlyCatalogCacheLoader'
/opt/mongodbtoolchain/v2/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
build/ninja/mongo/db/s/libsharding.so: error: undefined reference to 'mongo::ChunkSplitter::setReplicaSetMode(bool)'
build/ninja/mongo/db/s/libsharding.so: error: undefined reference to 'mongo::ChunkSplitter::get(mongo::OperationContext*)'
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

(I produced this by simply making service_context_d a Program instead of a Library, and adding a trivial main() module to it.)

This means that if you attempt to add service_context_d to a LIBDEPS section, without also adding the libraries containing the missing symbols to the same section, you will get link errors such as the above.

Would it be possible to, in general, enforce that our libraries can all stand by themselves with no undefined references? We could make a whitelist of libraries that cannot abide by this rule, if necessary.



 Comments   
Comment by Eric Milkie [ 02/May/18 ]

Kal is correct!

Comment by Kaloian Manassiev [ 02/May/18 ]

I would imagine this is a duplicate of SERVER-29908.

Comment by Eric Milkie [ 02/May/18 ]

Note that this particular error appears to be because the "sharding" library is referencing things in "sharding_runtime_d" but does not directly link against it. I suppose this means "sharding" is not independently linkable either.

Generated at Thu Feb 08 04:37:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.