assembler error: .size expression - mongodb 4.2.1 on freebsd-12/amd64

9 views
Skip to first unread message

Ronald Klop

unread,
Nov 16, 2019, 10:49:03 AM11/16/19
to mongo...@googlegroups.com
Hi,

I'm trying to create a port for mongodb 4.2.1 on FreeBSD. While compiling
on amd64 I get to following error from the assembler. Can somebody point
me in the right direction for the solution?

src/mongo/db/matcher/expression_type.h: In instantiation of
'std::unique_ptr<mongo::MatchExpression>
mongo::TypeMatchExpressionBase<T>::shallowClone() const [with T =
mongo::InternalSchemaBinDataEncryptedTypeExpression
]':
src/mongo/db/matcher/expression_type.h:69:38: required from here
src/mongo/db/matcher/expression_type.h:74:30: warning: redundant move in
return statement [-Wredundant-move]
74 | return std::move(expr);
| ^
src/mongo/db/matcher/expression_type.h:74:30: note: remove 'std::move' call
src/mongo/db/matcher/expression_type.h: In instantiation of
'std::unique_ptr<mongo::MatchExpression>
mongo::TypeMatchExpressionBase<T>::shallowClone() const [with T =
mongo::InternalSchemaTypeExpression]':
src/mongo/db/matcher/expression_type.h:69:38: required from here
src/mongo/db/matcher/expression_type.h:74:30: warning: redundant move in
return statement [-Wredundant-move]
src/mongo/db/matcher/expression_type.h:74:30: note: remove 'std::move' call
src/mongo/db/matcher/expression_type.h: In instantiation of
'std::unique_ptr<mongo::MatchExpression>
mongo::TypeMatchExpressionBase<T>::shallowClone() const [with T =
mongo::TypeMatchExpression]':
src/mongo/db/matcher/expression_type.h:69:38: required from here
src/mongo/db/matcher/expression_type.h:74:30: warning: redundant move in
return statement [-Wredundant-move]
src/mongo/db/matcher/expression_type.h:74:30: note: remove 'std::move' call
{standard input}: Assembler messages:
{standard input}:184634: Warning: end of file not at end of a line;
newline inserted
{standard input}: Error: .size expression for
_ZN4asio6detail11timer_queueINS0_18chrono_time_traitsINSt6chrono3_V212system_clockENS_11wait_traitsIS5_EEEEE12remove_timerERNS9_14per_timer_dataE
does not evaluate to a constant
g++9: fatal error: Killed signal terminated program cc1plus
compilation terminated.
scons: *** [build/opt/mongo/transport/transport_layer_asio.o] Error 1
scons: building terminated because of errors.
build/opt/mongo/transport/transport_layer_asio.o failed: Error 1

Regards,
Ronald.

Mathew Robinson

unread,
Nov 16, 2019, 11:02:42 AM11/16/19
to mongo...@googlegroups.com
I would be curious if GCC 8.2.0 works. I'm not sure that GCC 9+ works even on our supported platforms, we use 8.2.0 for all of our shipping builds.

--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/op.0bct60oseclrs1%40sjakie.


--
- Mathew Robinson

Ronald Klop

unread,
Nov 16, 2019, 7:42:00 PM11/16/19
to mongo...@googlegroups.com
Nevermind. Running make again went ok now.

But now it can't find system libraries like snappy and pcre:

...
ibsecure_compare_memory.a -Wl,--no-whole-archive -Wl,--whole-archive
build/opt/mongo/libbase.a -Wl,--no-whole-archive -Wl,--whole-archive
build/opt/third_party/murmurhash3/libmurmurhash3.a -Wl,--no-whole-archive
-Wl,--
whole-archive build/opt/third_party/libshim_pcrecpp.a
-Wl,--no-whole-archive -Wl,--whole-archive
build/opt/third_party/libshim_intel_decimal128.a -Wl,--no-whole-archive
build/opt/third_party/IntelRDFPMathLib20U1/libint
el_decimal128.a -Wl,--whole-archive build/opt/third_party/libshim_fmt.a
-Wl,--no-whole-archive -Wl,--whole-archive
build/opt/third_party/fmt/libfmt.a -Wl,--no-whole-archive
-Wl,--whole-archive build/opt/third_party/lib
shim_boost.a -Wl,--no-whole-archive -Wl,--whole-archive
build/opt/third_party/libshim_abseil.a -Wl,--no-whole-archive
-Wl,--whole-archive
build/opt/third_party/abseil-cpp-master/libabsl_container.a
-Wl,--no-whole-archi
ve -Wl,--whole-archive
build/opt/third_party/abseil-cpp-master/libabsl_hash.a
-Wl,--no-whole-archive -Wl,--whole-archive
build/opt/mongo/util/libquick_exit.a -Wl,--no-whole-archive
-Wl,--whole-archive build/opt/third_p
arty/libshim_allocator.a -Wl,--no-whole-archive
build/opt/mongo/util/libdebugger.a -Wl,--whole-archive
build/opt/mongo/libboost_assert_shim.a -Wl,--no-whole-archive
-Wl,--end-group -lz -lsnappy -lsasl2 -lcurl -lpcre -l
pcrecpp -lboost_program_options -lboost_filesystem -lboost_system
-lboost_iostreams -lkvm -lcrypto -lssl -lcrypto -lrt -ldl -lexecinfo
g++9 @/tmp/tmposuu4hx7.lnk
src/mongo/db/free_mon/free_mon_processor.cpp:724: error: undefined
reference to 'snappy::Compress(char const*, unsigned long,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*)'
src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp:76:
error: undefined reference to
'pcrecpp::RE::QuoteMeta[abi:cxx11](pcrecpp::StringPiece const&)'
src/mongo/s/catalog/sharding_catalog_client_impl.cpp:357: error: undefined
reference to 'pcrecpp::RE::QuoteMeta[abi:cxx11](pcrecpp::StringPiece
const&)'
/usr/local/include/boost/filesystem/path.hpp:165: error: undefined
reference to
'boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry
const&, std::__cxx11::basic_string<char, std::char_traits<cha
r>, std::allocator<char> >&)'
src/mongo/db/sorter/sorter.cpp:949: error: undefined reference to
'snappy::Compress(char const*, unsigned long,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*)'
src/mongo/db/sorter/sorter.cpp:949: error: undefined reference to
'snappy::Compress(char const*, unsigned long,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*)'
/usr/local/include/pcrecpp.h:491: error: undefined reference to
'pcrecpp::RE::Init(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, pcrecpp::RE_Options
const*)'
src/mongo/db/sorter/sorter.cpp:949: error: undefined reference to
'snappy::Compress(char const*, unsigned long,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*)'
/usr/local/include/pcrecpp.h:494: error: undefined reference to
'pcrecpp::RE::Init(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, pcrecpp::RE_Options
const*)'
/usr/local/include/pcrecpp.h:494: error: undefined reference to
'pcrecpp::RE::Init(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, pcrecpp::RE_Options
const*)'
/usr/local/include/pcrecpp.h:491: error: undefined reference to
'pcrecpp::RE::Init(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, pcrecpp::RE_Options
const*)'
src/mongo/util/options_parser/option_section.cpp:647: error: undefined
reference to
'boost::program_options::positional_options_description::name_for_position[abi:cxx11](unsigned
int) const'
src/mongo/util/options_parser/option_section.cpp:641: error: undefined
reference to
'boost::program_options::positional_options_description::name_for_position[abi:cxx11](unsigned
int) const'
...

Any thoughts?
If I need to provide more information, please tell.

> Regards,
> Ronald.

Mathew Robinson

unread,
Nov 17, 2019, 7:40:20 AM11/17/19
to mongo...@googlegroups.com
I would provide your entire scons command line generally. We have a lot of options and variables so seeing all of the ones you're using gives us a starting point.

We only guarantee that the vendored versions compile with MongoDB and have had a lot of problems with system versions in the past. It looks like you are but I want to confirm, you're using --use-system-X for those libraries correct?

--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev...@googlegroups.com.


--
- Mathew Robinson

Andrew Morrow

unread,
Nov 18, 2019, 1:26:02 PM11/18/19
to mongodb-dev

Hi -

To add to what Mathew said, we currently only test with GCC 8. There are often new warnings that are added to the newer versions of GCC that we don't yet have fixes or suppressions in place to handle. By default, the build system adds -Wall -Werror to the compiler flags, so all these new warnings become hard errors. You can relax that by adding the flag --disable-warnings-as-errors to your SCons invocation.

Thanks,
Andrew


Ronald Klop

unread,
Nov 18, 2019, 5:03:10 PM11/18/19
to mongo...@googlegroups.com
Hi,

Thank you for the responses. I indeed use --use-system-X for snappy, pcre, zlib and boost. This has been done in the freebsd ports of mongodb from before I started to use them. I'm not familiar with the reason why.
I found out my compile/link error is from cxx11 abi difference between the gcc9 compile and the clang compilation of the --use-system dependency. Google tells more about it. :-) Compiling without --use-system-X does solve the problem.
I'm now trying full clang build (using fix [1]) which is more consistent in the FreeBSD eco system. I think that will work out fine. Otherwise I'll just drop the --use-system-X options.

Regards and thanks,

Ronald.



On Mon, 18 Nov 2019 19:24:59 +0100, 'Andrew Morrow' via mongodb-dev <mongo...@googlegroups.com> wrote:


Hi -

To add to what Mathew said, we currently only test with GCC 8. There are often new warnings that are added to the newer versions of GCC that we don't yet have fixes or suppressions in place to handle. By default, the build system adds -Wall -Werror to the compiler flags, so all these new warnings become hard errors. You can relax that by adding the flag --disable-warnings-as-errors to your SCons invocation.

Thanks,
Andrew


On Sun, Nov 17, 2019 at 7:40 AM 'Mathew Robinson' via mongodb-dev <mongo...@googlegroups.com> wrote:
I would provide your entire scons command line generally. We have a lot of options and variables so seeing all of the ones you're using gives us a starting point.

We only guarantee that the vendored versions compile with MongoDB and have had a lot of problems with system versions in the past. It looks like you are but I want to confirm, you're using --use-system-X for those libraries correct?

On Sat, Nov 16, 2019 at 7:42 PM Ronald Klop <ron...@klop.ws> wrote:
On Sat, 16 Nov 2019 16:48:26 +0100, Ronald Klop <ron...@klop.ws> wrote:

> Hi,
>

[snip irrelevant earlier error]

Andrew Morrow

unread,
Nov 19, 2019, 1:07:16 PM11/19/19
to mongodb-dev

Hi Ronald -

For some context on why you may find the --use-system-x options to sometimes be used when building MongoDB for inclusion in a port or distro package: if a package we vendor (e.g. zlib) is found to contain a vulnerability and MongoDB has been dynamically linked to the system package for that library, then as soon as the system package is updated to address the vulnerability, then the fix applies to a restarted MongoDB server on the system. However, if MongoDB was built against its vendored copy of the library, the fix won't apply until we update the vendored copy and the MongoDB package is rebuilt from source. On the other hand, we don't test MongoDB built against the system versions of the packages that it vendors (the space of possibilities is simply to large), so building with --use-system-x has the possibility of either not building or not working correctly at runtime. Finally, we sometimes apply patches to our vendored libraries to resolve both general or MongoDB specific issues we find with them.

Note that we do regularly review the versions of vendored packages against the newest upstream releases with a particular eye towards addressed CVEs.

I hope this helps clarify the trade-offs around building with or without the --use-system-x flags.

Thanks,
Andrew


Reply all
Reply to author
Forward
0 new messages