boostorg / system

Boost.org system module
http://boost.org/libs/system
36 stars 85 forks source link

Link error with clang-7, cxxstd=14, variant=debug #115

Closed anarthal closed 9 months ago

anarthal commented 9 months ago

How to reproduce:

Failing with the following error (looks like in C++14, static constexpr variables are not handled correctly in some cases):

/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<unsigned short, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::userinfo_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::h16_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::ipvfuture_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::ipv6_addrz_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::port_part_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::urls::detail::userinfo_template_rule_t::value_type>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::port_rule::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::hier_part_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::variant2::variant<unsigned long, boost::optional<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long> > >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<unsigned char, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::params_encoded_view, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::core::basic_string_view<char> >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<unsigned char, unsigned char, unsigned char, unsigned char>, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::core::basic_string_view<char>, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::variant2::variant<boost::urls::url_view, boost::urls::url_view>, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::variant2::variant<boost::urls::url_view, boost::urls::url_view>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<unsigned short, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long> >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::core::basic_string_view<char>, boost::urls::pct_string_view>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::ipv4_address, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::grammar::range<std::tuple<boost::core::basic_string_view<char>, boost::urls::pct_string_view> >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::segments_encoded_view, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::core::basic_string_view<char>, boost::optional<boost::core::basic_string_view<char> > >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::urls::pct_string_view>, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::segments_encoded_view, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::authority_view, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::ipv4_address, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::h16_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::pattern, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::pct_string_view, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::ip_literal_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::host_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::hier_part_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::ipv6_address, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::core::basic_string_view<char>, boost::urls::pct_string_view>, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::core::basic_string_view<char>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::core::basic_string_view<char>, boost::optional<boost::core::basic_string_view<char> > >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::scheme_rule::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::variant2::variant<unsigned long, boost::optional<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long> > >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::fragment_part_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::pct_string_view, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::scheme_rule::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::query_part_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::url_view, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<void, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::core::basic_string_view<char>, boost::core::basic_string_view<char>, boost::core::basic_string_view<char>, boost::core::basic_string_view<char> >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::port_part_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::params_encoded_view, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::userinfo_template_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::optional<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long> >, boost::optional<boost::core::basic_string_view<char> > >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::relative_part_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long> >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::grammar::range<std::tuple<boost::core::basic_string_view<char>, boost::urls::pct_string_view> >, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<unsigned long, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::pattern, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::userinfo_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::urls::pct_string_view>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::ipv6_addrz_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::fragment_part_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::urls::detail::userinfo_rule_t::value_type>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::port_rule::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long>, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::url_view, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::host_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::userinfo_template_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::ipvfuture_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::ipv6_address, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<unsigned char, unsigned char, unsigned char, unsigned char>, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::relative_part_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::optional<boost::core::basic_string_view<char> >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<unsigned char, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::query_part_rule_t::value_type, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::authority_view, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<void, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::core::basic_string_view<char>, boost::core::basic_string_view<char>, boost::core::basic_string_view<char>, boost::core::basic_string_view<char> >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<boost::urls::detail::ip_literal_rule_t::value_type, boost::system::error_code>::in_place_error'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<std::tuple<boost::optional<boost::variant2::variant<boost::core::basic_string_view<char>, unsigned long> >, boost::optional<boost::core::basic_string_view<char> > >, boost::system::error_code>::in_place_value'
/usr/bin/ld: /opt/myboost/lib/libboost_url.so.1.84.0: undefined reference to `boost::system::result<unsigned long, boost::system::error_code>::in_place_error'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
alandefreitas commented 9 months ago

Man... C++ is complex 😆

I can't find the difference between this and what we test in https://github.com/boostorg/url/actions/runs/7173027751/job/19531625406#step:15:1

I'll ask around

alandefreitas commented 9 months ago

Do you have the complete workflow somewhere?

pdimov commented 9 months ago

Is this specific to clang-7?

pdimov commented 9 months ago

Interestingly, in_place_value and in_place_error aren't even used anywhere in Boost.URL.

pdimov commented 9 months ago

One thing to note is that you're building Boost explicitly with C++14, but your program doesn't set a C++ standard in CMakeLists. What C++ standard is being used while building it?

anarthal commented 9 months ago

I wrote the CML as a minimal reproducible example. The actual failure was encountered while linking a test executable against /boost/url//boost_url (everything happening in b2), in MySQL CIs. It doesn't happen in release mode.

The run is here. I don't do the entire clang coverage range, but doesn't happen in clang 3.6 or clang 11.

pdimov commented 9 months ago

OK, this is clearly a System issue, but I have no idea why it happens in the way it happens here, as these symbols don't seem to be referenced anywhere in URL. I do have an idea what I need to do to fix it, though. :-)

alandefreitas commented 9 months ago

I have no idea what just happened here 🤣

pdimov commented 9 months ago

I transferred the issue to System and fixed it. Or I think that I fixed it. :-)

pdimov commented 9 months ago

@anarthal Can you test develop and see if the issue is fixed?

anarthal commented 9 months ago

I can confirm this fixed the issue. Thanks.