Skip to content

Commit

Permalink
PSMDB-1266 Repair dynamic linkage
Browse files Browse the repository at this point in the history
  • Loading branch information
ktrushin authored Jun 5, 2023
2 parents 0a0309b + 2912dad commit 928e9a4
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 73 deletions.
63 changes: 51 additions & 12 deletions src/mongo/db/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ env.InjectThirdParty(libraries=[
's2',
])

if has_option('audit'):
env.SConscript(dirs='audit', exports='env')

env.SConscript(
dirs=[
'auth',
Expand Down Expand Up @@ -308,6 +305,7 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/util/options_parser/options_parser',
],
)

Expand Down Expand Up @@ -702,15 +700,55 @@ env.Library(
],
)

env.Clone().InjectModule("enterprise").Library(
target="audit",
source=[
"audit.cpp",
],
LIBDEPS=[
"$BUILD_DIR/mongo/base",
],
)
audit_libdeps = [
'$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'$BUILD_DIR/mongo/db/query_expressions',
'$BUILD_DIR/mongo/db/server_base',
'$BUILD_DIR/mongo/util/background_job',
]
if has_option('audit'):
# The Percona's `audit` library is intended to be a drop-in replacement of
# the upstream `audit` (please @see the `else` branch). Hense, it has to
# have the same filepath and set of dependencies as the upstream `audit`
# has. That's why the Percona's `audit` library is built here rather than in
# the `src/mongo/db/audit` directory.
env.Library(
target='audit',
source=[
'audit.cpp',
'audit/audit_flusher.cpp',
'audit/audit_options.cpp',
'audit/audit.cpp',
'audit/audit_parameters.idl',
'audit/audit_options.idl',
],
LIBDEPS=audit_libdeps,
)
# Please note that the `commands` library (@see below) depends on
# the `audit` library and the `audit_commands` depends on `commands`.
#
# Since the Percona's `audit` library is built in this file, it is natural
# to build `audit_commands` here as well rather than in
# the `src/mongo/db/audit` directory.
env.Library(
target='audit_commands',
source=[
'audit/audit_commands.cpp',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/commands/test_commands_enabled',
'audit',
'commands'
],
)
else:
env.Clone().InjectModule("enterprise").Library(
target="audit",
source=[
"audit.cpp",
],
LIBDEPS=audit_libdeps,
)

env.Library(
target='client_out_of_line_executor',
Expand Down Expand Up @@ -2273,6 +2311,7 @@ env.Library(
'$BUILD_DIR/mongo/util/version_impl',
'$BUILD_DIR/mongo/watchdog/watchdog_mongod',
'$BUILD_DIR/third_party/shim_snappy',
'audit_commands' if has_option('audit') else [],
'auth/auth_op_observer',
'auth/authmongod',
'bson/dotted_path_support',
Expand Down
29 changes: 0 additions & 29 deletions src/mongo/db/audit/SConscript

This file was deleted.

9 changes: 9 additions & 0 deletions src/mongo/db/auth/external/SConscript
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- mode: python -*-
Import("env")
Import("get_option")

env = env.Clone()

Expand All @@ -14,8 +15,16 @@ env.Library(
LIBDEPS=[
'$BUILD_DIR/mongo/db/auth/saslauth',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/client/sasl_aws_common' if get_option('ssl') == 'on' else [],
'$BUILD_DIR/mongo/db/ldap/ldapmanager',
'$BUILD_DIR/mongo/db/ldap_options',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/util/net/http_client',
],
SYSLIBDEPS=[
'gssapi_krb5',
'ldap',
'sasl2',
],
)
6 changes: 5 additions & 1 deletion src/mongo/db/backup/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ env.Library(
source=[
'backup_commands.cpp',
],
LIBDEPS=[
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/bson/mutable/mutable_bson',
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/commands',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/db/storage/storage_options',
],
)
11 changes: 8 additions & 3 deletions src/mongo/db/encryption/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ env.Library(
'$BUILD_DIR/mongo/db/encryption/encryption_kmip',
'$BUILD_DIR/mongo/db/encryption/encryption_options',
'$BUILD_DIR/mongo/db/encryption/encryption_vault',
'$BUILD_DIR/mongo/util/secure_zero_memory'
'$BUILD_DIR/mongo/util/secure_zero_memory',
'secret_string'
],
)

Expand Down Expand Up @@ -49,7 +50,9 @@ env.Library(
'winhttp' if env.TargetOSIs('windows') else 'curl',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/encryption/secret_string'
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/encryption/secret_string',
'encryption_options'
],
)

Expand All @@ -71,7 +74,9 @@ env.Library(
source=[
'encryption_kmip.cpp',
],
LIBDEPS=[
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/third_party/shim_kmippp',
'encryption_options'
],
)
5 changes: 5 additions & 0 deletions src/mongo/db/ldap/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ env.Library(
'ldap_manager.cpp',
'ldap_manager_impl.cpp',
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/ldap_options',
'$BUILD_DIR/mongo/db/service_context',
'$BUILD_DIR/mongo/util/background_job',
],
SYSLIBDEPS=[
'ldap',
'lber',
Expand Down
5 changes: 4 additions & 1 deletion src/mongo/db/pipeline/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ env.Library(
'document_source_backup_cursor.cpp',
'document_source_backup_cursor_extend.cpp',
],
LIBDEPS=[],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/server_base',
'pipeline',
],
)

env.Library(
Expand Down
1 change: 1 addition & 0 deletions src/mongo/db/storage/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ env.Library(
LIBDEPS=[],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/encryption/encryption_options',
'$BUILD_DIR/mongo/db/encryption/key',
'$BUILD_DIR/mongo/db/service_context',
'storage_change_lock',
Expand Down
5 changes: 3 additions & 2 deletions src/mongo/db/storage/inmemory/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ if inmemory:
'inmemory_options_init.cpp',
'inmemory_global_options.idl',
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger_core',
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/storage/storage_engine_common',
'$BUILD_DIR/mongo/db/storage/wiredtiger/storage_wiredtiger',
],
)

Expand Down
3 changes: 3 additions & 0 deletions src/mongo/db/storage/wiredtiger/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/encryption/encryption_options',
'$BUILD_DIR/mongo/db/service_context',
],
)
Expand All @@ -29,6 +30,7 @@ wtEnv.InjectThirdParty(libraries=['valgrind'])
wtEnv.Library(
target='storage_wiredtiger_core',
source=[
'encryption_extension.c',
'encryption_keydb.cpp',
'oplog_truncate_markers_server_status_section.cpp',
'wiredtiger_backup_cursor_hooks.cpp',
Expand Down Expand Up @@ -111,6 +113,7 @@ wtEnv.Library(
'aws-c-event-stream',
'aws-c-common',
'aws-checksums',
'curl',
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Copyright (C) 2018-present Percona and/or its affiliates. All rights reserved.
#include <wiredtiger.h>
#include <wiredtiger_ext.h>

#include "encryption_keydb_c_api.h"
#include "mongo/db/storage/wiredtiger/encryption_keydb_c_api.h"

#define KEY_LEN 32
#define GCM_TAG_LEN 16
Expand Down
3 changes: 1 addition & 2 deletions src/mongo/db/storage/wiredtiger/encryption_keydb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ Copyright (C) 2018-present Percona and/or its affiliates. All rights reserved.

#include <cstring> // memcpy

#include "mongo/db/storage/wiredtiger/encryption_keydb_c_api.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_util.h"
#include "mongo/logv2/log.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/debug_util.h"

#include <third_party/wiredtiger/ext/encryptors/percona/encryption_keydb_c_api.h>

#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ Copyright (C) 2018-present Percona and/or its affiliates. All rights reserved.
#include <openssl/err.h>

#include "mongo/base/status.h"
#include "mongo/db/storage/wiredtiger/encryption_keydb_c_api.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_data_protector.h"
#include "mongo/logv2/log.h"

#include <third_party/wiredtiger/ext/encryptors/percona/encryption_keydb_c_api.h>

#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ Copyright (C) 2018-present Percona and/or its affiliates. All rights reserved.
#include <wiredtiger.h>

#include "mongo/db/encryption/encryption_options.h"
#include "mongo/db/storage/wiredtiger/encryption_keydb_c_api.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_data_protector.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_encryption_hooks.h"
#include "mongo/logv2/log.h"

#include <third_party/wiredtiger/ext/encryptors/percona/encryption_keydb_c_api.h>

#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kStorage


Expand Down
2 changes: 2 additions & 0 deletions src/mongo/embedded/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import re

Import("env")
Import("get_option")
Import("has_option")
Import("wiredtiger")

env = env.Clone()
Expand Down Expand Up @@ -78,6 +79,7 @@ env.Library(
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/audit',
'$BUILD_DIR/mongo/db/audit_commands' if has_option('audit') else [],
'$BUILD_DIR/mongo/db/auth/auth',
'$BUILD_DIR/mongo/db/catalog/catalog_impl',
'$BUILD_DIR/mongo/db/catalog/database_holder',
Expand Down
3 changes: 3 additions & 0 deletions src/mongo/s/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Import([
"env",
"get_option",
"has_option",
"version_extra",
"version_parts",
])
Expand Down Expand Up @@ -458,6 +459,7 @@ env.Library(
# NOTE: If you need to add a static or mongo initializer to mongos startup,
# please add that library here, as a private library dependency.
'$BUILD_DIR/mongo/db/audit',
'$BUILD_DIR/mongo/db/audit_commands' if has_option('audit') else [],
'$BUILD_DIR/mongo/db/auth/authmongos',
'$BUILD_DIR/mongo/db/commands/server_status_core',
'$BUILD_DIR/mongo/db/commands/server_status_servers',
Expand Down Expand Up @@ -535,6 +537,7 @@ env.Library(
'$BUILD_DIR/mongo/db/change_streams_cluster_parameter',
'$BUILD_DIR/mongo/db/commands/rwc_defaults_commands',
'$BUILD_DIR/mongo/db/ftdc/ftdc_mongos',
'$BUILD_DIR/mongo/db/ldap/ldapmanager',
'$BUILD_DIR/mongo/db/process_health/fault_manager',
'$BUILD_DIR/mongo/db/read_write_concern_defaults',
'$BUILD_DIR/mongo/db/serverinit',
Expand Down
1 change: 1 addition & 0 deletions src/mongo/shell/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ if not has_option('noshell') and jsEngine:
# please add that library here, as a private library dependency.
"$BUILD_DIR/mongo/client/clientdriver_network",
"$BUILD_DIR/mongo/client/connection_string",
"$BUILD_DIR/mongo/db/audit_commands" if has_option('audit') else '',
"$BUILD_DIR/mongo/db/catalog/index_key_validate",
"$BUILD_DIR/mongo/db/mongohasher",
"$BUILD_DIR/mongo/db/pipeline/change_stream_error_extra_info",
Expand Down
3 changes: 2 additions & 1 deletion src/third_party/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,11 @@ if wiredtiger:
])
else:
wiredtigerEnv = wiredtigerEnv.Clone()
wiredtigerEnv.InjectThirdParty(libraries=['wiredtiger'])
wiredtigerEnv.InjectThirdParty(libraries=['wiredtiger', 'wiredtiger_checksum'])
wiredtigerEnv.SConscript('wiredtiger/SConscript', exports={'env': wiredtigerEnv})
wiredtigerEnv = wiredtigerEnv.Clone(LIBDEPS_INTERFACE=[
'wiredtiger/wiredtiger',
'wiredtiger/wiredtiger_checksum',
])

wiredtigerEnv.ShimLibrary(name="wiredtiger")
Expand Down
3 changes: 0 additions & 3 deletions src/third_party/wiredtiger/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,6 @@ with open(File(filelistfile).srcnode().abspath) as filelist:
with open(File(filelistfile).srcnode().abspath) as filelist:
cssources = list(filtered_filelist(filelist, True))

# unconditionally add Percona encryption extension
wtsources.append("ext/encryptors/percona/encryption_extension.c")

if useZlib:
env.Append(CPPDEFINES=['HAVE_BUILTIN_EXTENSION_ZLIB'])
wtsources.append("ext/compressors/zlib/zlib_compress.c")
Expand Down
14 changes: 0 additions & 14 deletions src/third_party/wiredtiger/ext/encryptors/percona/Makefile.am

This file was deleted.

0 comments on commit 928e9a4

Please sign in to comment.