<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:19:02 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-49141] Coverity build of mongodb/mongo failing with link error for libunwind</title>
                <link>https://jira.mongodb.org/browse/SERVER-49141</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Coverity builds with this command line:&lt;/p&gt;

&lt;p&gt;/usr/local/bin/python3 buildscripts/scons.py --install-mode=hygienic install-all --keep-going --variables-files=etc/scons/mongodbtoolchain_stable_gcc.vars --disable-warnings-as-errors -j6 --opt=off --dbg=off --allocator=system --link-model=dynamic&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;And as of last night, ran a build at the head of mongodb main branch and encountered this linker error:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;Using tempfile /data/tmp/tmp8igx5fge.lnk for command line:&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;/opt/mongodbtoolchain/v3/bin/g++ -o build/7a67446c/mongo/util/stacktrace_bm -Wl,--no-as-needed -pthread -Wl,-z,now -rdynamic -fstack-protector-strong -fuse-ld=gold -Wl,--gdb-index -Wl,--no-threads -Wl,--build-id -Wl,--hash-style=gnu -Wl,-z,noexecstack -Wl,--warn-execstack -Wl,-z,relro -Wl,-rpath,/usr/lib64/perl5/CORE -Wl,-z,origin -Wl,--enable-new-dtags -pie -Wl,-rpath=\$ORIGIN/../lib build/7a67446c/mongo/util/stacktrace_bm.o -Wl,-z,defs -Wl,--whole-archive build/7a67446c/mongo/unittest/libbenchmark_main.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/libshim_benchmark.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/benchmark/libbenchmark.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/libservice_context.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/util/net/libnetwork.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/util/libperiodic_runner.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/util/libfail_point.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/util/libclock_sources.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/util/concurrency/libspin_lock.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/storage/libwrite_unit_of_work.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/storage/librecovery_unit_base.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/libwrite_concern_options.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/libread_write_concern_provenance.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/bson/util/libbson_extract.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/libmulti_key_path_tracker.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/liblogical_session_id.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/idl/libserver_parameter.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/idl/libidl_parser.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/libcommand_generic_argument.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/db/commands/libserver_status_core.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/crypto/libsha_block_openssl.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/crypto/libsha1_block.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/crypto/libsha256_block.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/util/libsecure_compare_memory.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/libbase.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/murmurhash3/libmurmurhash3.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/libshim_fmt.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/fmt/libfmt.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/libshim_boost.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/boost-1.70.0/libboost_program_options.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/boost-1.70.0/libboost_log.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/boost-1.70.0/libboost_thread.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/boost-1.70.0/libboost_iostreams.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/boost-1.70.0/libboost_filesystem.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/boost-1.70.0/libboost_system.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/mongo/libboost_assert_shim.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/libshim_abseil.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/abseil-cpp-master/libabsl_container.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/abseil-cpp-master/libabsl_throw_delegate.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/abseil-cpp-master/libabsl_hash.so -Wl,--no-whole-archive -Wl,--whole-archive build/7a67446c/third_party/libshim_allocator.so -Wl,--no-whole-archive -llzma -llzma -llzma -lm -lresolv -lcrypto -lssl -lcrypto -ldl -lrt -ldl&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;/opt/mongodbtoolchain/v3/bin/g++ @/data/tmp/tmp8igx5fge.lnk&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/mongo/util/stacktrace_bm.cpp:113: error: undefined reference to &apos;_Ux86_64_getcontext&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/mongo/util/stacktrace_bm.cpp:114: error: undefined reference to &apos;_Ux86_64_strerror&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/mongo/util/stacktrace_bm.cpp:118: error: undefined reference to &apos;_ULx86_64_init_local&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/mongo/util/stacktrace_bm.cpp:119: error: undefined reference to &apos;_Ux86_64_strerror&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/mongo/util/stacktrace_bm.cpp:124: error: undefined reference to &apos;_ULx86_64_step&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/mongo/util/stacktrace_bm.cpp:125: error: undefined reference to &apos;_Ux86_64_strerror&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;collect2: error: ld returned 1 exit status&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;scons: *** [build/7a67446c/mongo/util/stacktrace_bm] Error 1 &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment></environment>
        <key id="1392997">SERVER-49141</key>
            <summary>Coverity build of mongodb/mongo failing with link error for libunwind</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13201">Fixed</resolution>
                                        <assignee username="andrew.morrow@mongodb.com">Andrew Morrow</assignee>
                                    <reporter username="milkie@mongodb.com">Eric Milkie</reporter>
                        <labels>
                    </labels>
                <created>Fri, 26 Jun 2020 12:46:31 +0000</created>
                <updated>Sun, 29 Oct 2023 22:06:24 +0000</updated>
                            <resolved>Mon, 29 Jun 2020 18:01:55 +0000</resolved>
                                                    <fixVersion>4.7.0</fixVersion>
                                    <component>Build</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3228630" author="xgen-internal-githook" created="Mon, 29 Jun 2020 18:01:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Andrew Morrow&apos;, &apos;email&apos;: &apos;acm@mongodb.com&apos;, &apos;username&apos;: &apos;acmorrow&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-49141&quot; title=&quot;Coverity build of mongodb/mongo failing with link error for libunwind&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-49141&quot;&gt;&lt;del&gt;SERVER-49141&lt;/del&gt;&lt;/a&gt; Ensure that LIBDEPS for libunwind do not accidentally become public&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/5394c832f05414fabd069c54066746e127f5d2e0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/5394c832f05414fabd069c54066746e127f5d2e0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3225655" author="acm" created="Fri, 26 Jun 2020 14:27:13 +0000"  >&lt;p&gt;This was caused by the changes in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48546&quot; title=&quot;Linker error building with scons --gdbserver&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48546&quot;&gt;&lt;del&gt;SERVER-48546&lt;/del&gt;&lt;/a&gt;. The root cause is interesting enough to warrant a somewhat detailed writeup.&lt;/p&gt;

&lt;p&gt;At its simplest, the cause here is that when building in &lt;tt&gt;--link-model=dynamic --allocator=system&lt;/tt&gt; the &lt;tt&gt;stacktrace_bm&lt;/tt&gt; target doesn&apos;t end up with &lt;tt&gt;libunwind&lt;/tt&gt; on its link line, as it clearly must always have if it is going to link, since it directly uses symbols from the library.&lt;/p&gt;

&lt;p&gt;A quick look suggests that the answer is simple: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48546&quot; title=&quot;Linker error building with scons --gdbserver&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48546&quot;&gt;&lt;del&gt;SERVER-48546&lt;/del&gt;&lt;/a&gt; (apparently, read on) moved &lt;tt&gt;shim_unwind&lt;/tt&gt; from &lt;tt&gt;LIBDEPS&lt;/tt&gt; to &lt;tt&gt;LIBDEPS_PRIVATE&lt;/tt&gt; for &lt;tt&gt;base&lt;/tt&gt; and &lt;tt&gt;libtcmalloc_minimal&lt;/tt&gt;, so in a &lt;tt&gt;--link-model=dynamic&lt;/tt&gt; build, the &lt;tt&gt;stacktrace_bm&lt;/tt&gt; &lt;tt&gt;Program&lt;/tt&gt; was no longer picking up a transitive dependency to &lt;tt&gt;shim_unwind&lt;/tt&gt;, which would cause it to fail to link. So the answer appears to be that &lt;tt&gt;shim_unwind&lt;/tt&gt; should be added to &lt;tt&gt;LIBDEPS&lt;/tt&gt; for &lt;tt&gt;stacktrace_bm&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;This leads to an obvious question of why such a clear error didn&apos;t fail either the &lt;tt&gt;! Shared Library Enterprise RHEL 6.2&lt;/tt&gt; builders &lt;tt&gt;compile_all&lt;/tt&gt; task, or the &lt;tt&gt;Enterprise RHEL 6.2 (Benchmarks)&lt;/tt&gt; builders &lt;tt&gt;compile_benchmarks&lt;/tt&gt; task. The latter is easily answered: the &lt;tt&gt;Benchmarks&lt;/tt&gt; builder builds in static mode, not dynamic. It also implicitly uses &lt;tt&gt;--allocator=tcmalloc&lt;/tt&gt;, and ultimately the &lt;tt&gt;tcmalloc_minimal&lt;/tt&gt; library has a dependency on &lt;tt&gt;libunwind&lt;/tt&gt;. Since the &lt;tt&gt;PUBLIC&lt;/tt&gt;/&lt;tt&gt;PRIVATE&lt;/tt&gt; distinction doesn&apos;t exist in static builds, the link of &lt;tt&gt;stacktrace_bm&lt;/tt&gt; includes &lt;tt&gt;libunwind&lt;/tt&gt; via transitivity, and everything works.&lt;/p&gt;

&lt;p&gt;The former case is much more interesting. If &lt;tt&gt;libunwind&lt;/tt&gt; has been made &lt;tt&gt;LIBDEPS_PRIVATE&lt;/tt&gt; to both &lt;tt&gt;base&lt;/tt&gt; and &lt;tt&gt;tcmalloc_minimal&lt;/tt&gt;, how could &lt;tt&gt;stacktrace_bm&lt;/tt&gt; have linked at all? Since we are using &lt;tt&gt;--link-model=dynamic&lt;/tt&gt;, &lt;tt&gt;LIBDEPS_PRIVATE&lt;/tt&gt; is enabled, and &lt;tt&gt;libunwind&lt;/tt&gt; should not appear on the link line for &lt;tt&gt;stacktrace_bm&lt;/tt&gt;, so we would expect the link to fail. But when we examine the logs, we find that, somehow &lt;tt&gt;libunwind&lt;/tt&gt; &lt;b&gt;does&lt;/b&gt; appear on the link line for &lt;tt&gt;stacktrace_bm&lt;/tt&gt;. So everything links just fine.&lt;/p&gt;

&lt;p&gt;The important clue is that if you switch the build to use &lt;tt&gt;--allocator=system --link-model=dynamic&lt;/tt&gt;, suddenly the test breaks. So, despite the fact that after &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48546&quot; title=&quot;Linker error building with scons --gdbserver&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48546&quot;&gt;&lt;del&gt;SERVER-48546&lt;/del&gt;&lt;/a&gt; &lt;tt&gt;libtcmalloc_minimal&lt;/tt&gt; declares &lt;tt&gt;libunwind&lt;/tt&gt; as a &lt;tt&gt;LIBDEPS_PRIVATE&lt;/tt&gt; edge, it appears to be behaving as if it was a public &lt;tt&gt;LIBDEP&lt;/tt&gt;. How can this be?&lt;/p&gt;

&lt;p&gt;Searching for all instances of &lt;tt&gt;shim_unwind&lt;/tt&gt; provides the answer. The behavior of &lt;tt&gt;env.InjectThirdParty(libraries=[&apos;unwind&apos;])&lt;/tt&gt;, which is used in the &lt;tt&gt;Environment&lt;/tt&gt; setup for both &lt;tt&gt;base&lt;/tt&gt; and &lt;tt&gt;tcmalloc_minimal&lt;/tt&gt; sets &lt;tt&gt;LIBDEPS&lt;/tt&gt; to &lt;tt&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;$BUILD_DIR/third_party/shim_unwind&amp;#39;&amp;#93;&lt;/span&gt;&lt;/tt&gt;, effectively making the &lt;tt&gt;unwind&lt;/tt&gt; dependency a public &lt;tt&gt;LIBDEP&lt;/tt&gt; in the affected &lt;tt&gt;Environment&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;But if that were the whole story, then &lt;tt&gt;shim_unwind&lt;/tt&gt; would have become a public &lt;tt&gt;LIBDEP&lt;/tt&gt; for &lt;tt&gt;libbase&lt;/tt&gt; and &lt;tt&gt;stacktrace_bm&lt;/tt&gt; should have linked!&lt;/p&gt;

&lt;p&gt;Which brings in the last piece. The &lt;tt&gt;Library&lt;/tt&gt; declaration for &lt;tt&gt;base&lt;/tt&gt; has explicit &lt;tt&gt;LIBDEPS&lt;/tt&gt; and &lt;tt&gt;LIBDEPS_PRIVATE&lt;/tt&gt; overrides in its environment. So the &lt;tt&gt;LIBDEPS&lt;/tt&gt; value set by &lt;tt&gt;env.InjectThirdParty(libraries=[&apos;unwind&apos;])&lt;/tt&gt; is overwritten and ignored. So &lt;tt&gt;unwind&lt;/tt&gt; remains a private &lt;tt&gt;LIBDEP&lt;/tt&gt; of &lt;tt&gt;base&lt;/tt&gt;: linking only to &lt;tt&gt;base&lt;/tt&gt; won&apos;t get you &lt;tt&gt;unwind&lt;/tt&gt;. But the &lt;tt&gt;Library&lt;/tt&gt; declaration for &lt;tt&gt;tcmalloc_minimal&lt;/tt&gt; only has an override for &lt;tt&gt;LIBDEPS_PRIVATE&lt;/tt&gt;, so the &lt;tt&gt;LIBDEPS&lt;/tt&gt; value injected by &lt;tt&gt;env.InjectThirdParty(libraries=[&apos;unwind&apos;])&lt;/tt&gt;, remains effective: &lt;tt&gt;unwind&lt;/tt&gt; is &lt;tt&gt;LIBDEPS_PUBLIC&lt;/tt&gt; in &lt;tt&gt;tcmalloc_minimal&lt;/tt&gt; (and also LIBDEPS_PRIVATE, which is why &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48638&quot; title=&quot;Enforce more rules for LIBDEPS&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48638&quot;&gt;&lt;del&gt;SERVER-48638&lt;/del&gt;&lt;/a&gt; would have caught this). So, as long as &lt;tt&gt;-&lt;del&gt;allocator=tcmalloc&lt;/tt&gt; is in play, &lt;tt&gt;stacktrace_bm&lt;/tt&gt; picks up a dependency on &lt;tt&gt;libunwind&lt;/tt&gt; transitively via &lt;tt&gt;tcmalloc_minimal&lt;/tt&gt;. But if you switch to &lt;tt&gt;&lt;/del&gt;-allocator=system&lt;/tt&gt;, then suddenly you don&apos;t pick up that tricky transitive dependency, and &lt;tt&gt;unwind&lt;/tt&gt; is now private to &lt;tt&gt;libbase&lt;/tt&gt;, and &lt;tt&gt;stacktrace_bm&lt;/tt&gt; doesn&apos;t declare a dependency, so it fails to link.&lt;/p&gt;

&lt;p&gt;There are several lessons to learn from this:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;We should implement the suggestions in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48638&quot; title=&quot;Enforce more rules for LIBDEPS&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48638&quot;&gt;&lt;del&gt;SERVER-48638&lt;/del&gt;&lt;/a&gt;, which would have flagged that &lt;tt&gt;shim_libunwind&lt;/tt&gt; was both public and private to &lt;tt&gt;libtcmalloc_minimal&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;We should remove the injection into &lt;tt&gt;LIBDEPS&lt;/tt&gt; in &lt;tt&gt;env.InjectThirdParty(libraries=[&apos;unwind&apos;])&lt;/tt&gt;. Stylistically, libraries don&apos;t expect the &lt;tt&gt;env&lt;/tt&gt; to already have &lt;tt&gt;LIBDEPS[_PRIVATE|INTERFACE]&lt;/tt&gt; set and always do a hard override.&lt;/li&gt;
	&lt;li&gt;We should investigate a less fragile mechanism for &lt;tt&gt;InjectThirdParty&lt;/tt&gt; which does not allow its modifications to be silently discarded.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The immediate fix for the issue is straightforward. We will remove the modification of &lt;tt&gt;LIBDEPS&lt;/tt&gt; from the behavior of &lt;tt&gt;env.InjectThirdParty(libraries=[&apos;unwind&apos;])&lt;/tt&gt;, and directly attach &lt;tt&gt;shim_unwind&lt;/tt&gt; in all the required places.&lt;/p&gt;

</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="1389492">SERVER-49074</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1393204">SERVER-49148</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 26 Jun 2020 14:27:13 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 32 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 32 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>andrew.morrow@mongodb.com</customfieldvalue>
            <customfieldvalue>milkie@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxs1fr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxgzhz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="4006">Dev Platform 2020-06-29</customfieldvalue>
    <customfieldvalue id="4007">Dev Platform 2020-07-13</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxrnp3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>