1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
From https://aur.archlinux.org/cgit/aur.git/tree/mongodb-8.0.12-sconstruct.patch?h=mongodb
diff --git a/SConstruct.orig b/SConstruct
index 74a32f0..d9dba9f 100644
--- a/SConstruct.orig
+++ b/SConstruct
@@ -3123,7 +3123,7 @@ if env.TargetOSIs('posix'):
env.Append(
CCFLAGS=[
"-fasynchronous-unwind-tables",
- "-g2" if not env.TargetOSIs('emscripten') else "-g",
+# "-g2" if not env.TargetOSIs('emscripten') else "-g",
"-Wall",
"-Wsign-compare",
"-Wno-unknown-pragmas",
@@ -3191,6 +3191,8 @@ if env.TargetOSIs('posix'):
# env.Append( " -Wconversion" ) TODO: this doesn't really work yet
env.Append(CXXFLAGS=["-Woverloaded-virtual"])
+ env.Append(CXXFLAGS=os.environ['CXXFLAGS'])
+ env.Append(LINKFLAGS=os.environ['LDFLAGS'])
# On OS X, clang doesn't want the pthread flag at link time, or it
# issues warnings which make it impossible for us to declare link
@@ -3243,7 +3245,7 @@ if env.TargetOSIs('posix'):
], )
#make scons colorgcc friendly
- for key in ('HOME', 'TERM'):
+ for key in ('HOME', 'TERM', 'PATH'):
try:
env['ENV'][key] = os.environ[key]
except KeyError:
@@ -3637,35 +3639,35 @@ def doConfigure(myenv):
myenv.AddMethod(
functools.partial(var_func, var=var, func=CheckFlag), f"Check{var}Supported")
- if myenv.ToolchainIs('gcc', 'clang'):
- # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
- # because it is much faster. Don't use it if the user has already configured another linker
- # selection manually.
- if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']):
- myenv.FatalError(
- f"Use the '--linker' option instead of modifying the LINKFLAGS directly.")
-
- linker_ld = get_option('linker')
-
- if linker_ld == "bfd" and env.get("BAZEL_BUILD_ENABLED"):
- myenv.FatalError(f"The linker 'bfd' is not supported with BAZEL_BUILD_ENABLED.")
- elif linker_ld == 'auto':
- if not env.TargetOSIs('darwin', 'macOS'):
- if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'):
- myenv.FatalError(
- f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'."
- )
- elif link_model.startswith("dynamic") and linker_ld == 'bfd':
- # BFD is not supported due to issues with it causing warnings from some of
- # the third party libraries that mongodb is linked with:
- # https://jira.mongodb.org/browse/SERVER-49465
- myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.")
- else:
- if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'):
- myenv.FatalError(f"Linker {linker_ld} could not be configured.")
-
- if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'):
- myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single'])
+# if myenv.ToolchainIs('gcc', 'clang'):
+# # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
+# # because it is much faster. Don't use it if the user has already configured another linker
+# # selection manually.
+# if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']):
+# myenv.FatalError(
+# f"Use the '--linker' option instead of modifying the LINKFLAGS directly.")
+#
+# linker_ld = get_option('linker')
+#
+# if linker_ld == "bfd" and env.get("BAZEL_BUILD_ENABLED"):
+# myenv.FatalError(f"The linker 'bfd' is not supported with BAZEL_BUILD_ENABLED.")
+# elif linker_ld == 'auto':
+# if not env.TargetOSIs('darwin', 'macOS'):
+# if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'):
+# myenv.FatalError(
+# f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'."
+# )
+# elif link_model.startswith("dynamic") and linker_ld == 'bfd':
+# # BFD is not supported due to issues with it causing warnings from some of
+# # the third party libraries that mongodb is linked with:
+# # https://jira.mongodb.org/browse/SERVER-49465
+# myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.")
+# else:
+# if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'):
+# myenv.FatalError(f"Linker {linker_ld} could not be configured.")
+#
+# if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'):
+# myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single'])
detectCompiler = Configure(
myenv,
@@ -4763,42 +4765,42 @@ def doConfigure(myenv):
if optBuild == "off" and myenv.ToolchainIs('clang') and env.TargetOSIs('darwin'):
myenv.AddToLINKFLAGSIfSupported("-Wl,-no_deduplicate")
- # Apply any link time optimization settings as selected by the 'lto' option.
- if has_option('lto'):
- if myenv.ToolchainIs('msvc'):
- # Note that this is actually more aggressive than LTO, it is whole program
- # optimization due to /GL. However, this is historically what we have done for
- # windows, so we are keeping it.
- #
- # /GL implies /LTCG, so no need to say it in CCFLAGS, but we do need /LTCG on the
- # link flags.
- myenv.Append(CCFLAGS=['/GL'])
- myenv.Append(LINKFLAGS=['/LTCG'])
- myenv.Append(ARFLAGS=['/LTCG'])
- elif myenv.ToolchainIs('gcc', 'clang'):
- # For GCC and clang, the flag is -flto, and we need to pass it both on the compile
- # and link lines.
- if not myenv.AddToCCFLAGSIfSupported('-flto') or \
- not myenv.AddToLINKFLAGSIfSupported('-flto'):
- myenv.ConfError("Link time optimization requested, "
- "but selected compiler does not honor -flto")
-
- if myenv.TargetOSIs('darwin'):
- myenv.AddToLINKFLAGSIfSupported('-Wl,-object_path_lto,${TARGET}.lto')
- else:
- # According to intel benchmarks -fno-plt increases perf
- # See PM-2215
- if linker_ld != "gold":
- myenv.ConfError("lto compilation currently only works with the --linker=gold")
- if link_model != "object":
- myenv.ConfError(
- "lto compilation currently only works with the --link-model=object")
- if not myenv.AddToCCFLAGSIfSupported('-fno-plt') or \
- not myenv.AddToLINKFLAGSIfSupported('-fno-plt'):
- myenv.ConfError("-fno-plt is not supported by the compiler")
-
- else:
- myenv.ConfError("Don't know how to enable --lto on current toolchain")
+# # Apply any link time optimization settings as selected by the 'lto' option.
+# if has_option('lto'):
+# if myenv.ToolchainIs('msvc'):
+# # Note that this is actually more aggressive than LTO, it is whole program
+# # optimization due to /GL. However, this is historically what we have done for
+# # windows, so we are keeping it.
+# #
+# # /GL implies /LTCG, so no need to say it in CCFLAGS, but we do need /LTCG on the
+# # link flags.
+# myenv.Append(CCFLAGS=['/GL'])
+# myenv.Append(LINKFLAGS=['/LTCG'])
+# myenv.Append(ARFLAGS=['/LTCG'])
+# elif myenv.ToolchainIs('gcc', 'clang'):
+# # For GCC and clang, the flag is -flto, and we need to pass it both on the compile
+# # and link lines.
+# if not myenv.AddToCCFLAGSIfSupported('-flto') or \
+# not myenv.AddToLINKFLAGSIfSupported('-flto'):
+# myenv.ConfError("Link time optimization requested, "
+# "but selected compiler does not honor -flto")
+#
+# if myenv.TargetOSIs('darwin'):
+# myenv.AddToLINKFLAGSIfSupported('-Wl,-object_path_lto,${TARGET}.lto')
+# else:
+# # According to intel benchmarks -fno-plt increases perf
+# # See PM-2215
+# if linker_ld != "gold":
+# myenv.ConfError("lto compilation currently only works with the --linker=gold")
+# if link_model != "object":
+# myenv.ConfError(
+# "lto compilation currently only works with the --link-model=object")
+# if not myenv.AddToCCFLAGSIfSupported('-fno-plt') or \
+# not myenv.AddToLINKFLAGSIfSupported('-fno-plt'):
+# myenv.ConfError("-fno-plt is not supported by the compiler")
+#
+# else:
+# myenv.ConfError("Don't know how to enable --lto on current toolchain")
if get_option('runtime-hardening') == "on" and optBuild != "off":
# Older glibc doesn't work well with _FORTIFY_SOURCE=2. Selecting 2.11 as the minimum was an
@@ -5261,16 +5263,17 @@ def doConfigure(myenv):
"BOOST_LOG_NO_SHORTHAND_NAMES",
"BOOST_LOG_USE_NATIVE_SYSLOG",
"BOOST_LOG_WITHOUT_THREAD_ATTR",
+ "BOOST_LOG_DYN_LINK",
"BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS",
"BOOST_SYSTEM_NO_DEPRECATED",
"BOOST_THREAD_USES_DATETIME",
("BOOST_THREAD_VERSION", "5"),
])
- if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk':
- conf.env.AppendUnique(CPPDEFINES=[
- "BOOST_LOG_DYN_LINK",
- ])
+# if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk':
+# conf.env.AppendUnique(CPPDEFINES=[
+# "BOOST_LOG_DYN_LINK",
+# ])
if use_system_version_of_library("boost"):
if not conf.CheckCXXHeader("boost/filesystem/operations.hpp"):
@@ -5471,6 +5474,8 @@ def doConfigure(myenv):
mongoc_mode = get_option('use-system-mongo-c')
conf.env['MONGO_HAVE_LIBMONGOC'] = False
+ # conf.env.ParseConfig('pkg-config libbson-1.0 libmongoc-1.0 --cflags')
+ # conf.env['LIBDEPS_LIBBSON_SYSLIBDEP'] = 'bson-1.0'
if mongoc_mode != 'off':
if conf.CheckLibWithHeader(
["mongoc-1.0"],
|