Need help with pybind11 c++ compilation warning/error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm working on updating libmamba to 2.0.X [1] but hitting the following error:

cd /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/redhat-linux-build/libmambapy && /usr/lib64/ccache/g++ -DFMT_SHARED -DMAMBA_USE_INSTALL_PREFIX_AS_BASE -DSPDLOG_FMT_EXTERNAL -DSPDLOG_FWRITE_UNLOCKED -Dbindings_EXPORTS -I/home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings -I/home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmamba/include -isystem /usr/include/python3.13 -isystem /usr/share -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O2 -g -DNDEBUG -fPIC -fvisibility=hidden -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wunreachable-code -Wuninitialized -Werror -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast -Wno-error=deprecated-declarations -MD -MT libmambapy/CMakeFiles/bindings.dir/src/libmambapy/bindings/legacy.cpp.o -MF CMakeFiles/bindings.dir/src/libmambapy/bindings/legacy.cpp.o.d -o CMakeFiles/bindings.dir/src/libmambapy/bindings/legacy.cpp.o -c /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings/legacy.cpp

/home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings/legacy.cpp: In lambda function: /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings/legacy.cpp:557:47: warning: ‘mamba::expected_t<std::__cxx11::basic_string<char> > mamba::SubdirData::cache_path() const’ is deprecated: since version 2.0 use ``valid_solv_cache`` or ``valid_json_cache`` instead [-Wdeprecated-declarations]
  557 |                 return extract(self.cache_path());
      |                                ~~~~~~~~~~~~~~~^~
In file included from /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings/legacy.cpp:30: /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmamba/include/mamba/core/subdirdata.hpp:135:33: note: declared here
  135 |         expected_t<std::string> cache_path() const;
      |                                 ^~~~~~~~~~
In file included from /usr/include/pybind11/attr.h:14,
                 from /usr/include/pybind11/detail/class.h:12,
                 from /usr/include/pybind11/pybind11.h:12,
                 from /usr/include/pybind11/functional.h:14,
from /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings/legacy.cpp:11: In function ‘pybind11::detail::collect_arguments<(pybind11::return_value_policy)1, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, pybind11::arg_v, void>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>&&, pybind11::arg_v&&)pybind11::detail::unpacking_collector<(pybind11::return_value_policy)1>’, inlined from ‘pybind11::detail::object_api<pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr> >::operator()<(pybind11::return_value_policy)1, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, pybind11::arg_v>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>&&, pybind11::arg_v&&) constpybind11::object’ at /usr/include/pybind11/cast.h:1823:45, inlined from ‘deprecated(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >)’ at /home/orion/fedora/libmamba/libmamba-2.0.6-build/mamba-2.0.6/libmambapy/src/libmambapy/bindings/legacy.cpp:52:26: /usr/include/pybind11/cast.h:1812:67: error: ‘SR.32262’ may be used uninitialized [-Werror=maybe-uninitialized] 1812 | return unpacking_collector<policy>(std::forward<Args>(args)...);
      |                                                                   ^
/usr/include/pybind11/cast.h: In function ‘deprecated(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >)’:
/usr/include/pybind11/cast.h:1823:45: note: ‘SR.32262’ was declared here
1823 | return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [libmambapy/CMakeFiles/bindings.dir/build.make:96: libmambapy/CMakeFiles/bindings.dir/src/libmambapy/bindings/legacy.cpp.o] Error 1

I'm guessing 'SR.32262' is some kind of temporary variable. libmamba has taken the (perhaps admirable?) step of compiling with -Werror so it fails.

The pybind11/cast.h function is:

/// Collect all arguments, including keywords and unpacking (only instantiated when needed)
template <return_value_policy policy,
          typename... Args,
          typename = enable_if_t<!args_are_all_positional<Args...>()>>
unpacking_collector<policy> collect_arguments(Args &&...args) {
// Following argument order rules for generalized unpacking according to PEP 448
    static_assert(constexpr_last<is_positional, Args...>()
                          < constexpr_first<is_keyword_or_ds, Args...>()
                      && constexpr_last<is_s_unpacking, Args...>()
                             < constexpr_first<is_ds_unpacking, Args...>(),
"Invalid function call: positional args must precede keywords and ** unpacking; "
                  "* unpacking must precede ** unpacking");
    return unpacking_collector<policy>(std::forward<Args>(args)...);
}

and it error on the return line.

libmambapy/bindings/legacy.cpp:52:26: is

warnings.attr("warn")(total_message, builtins.attr("DeprecationWarning"), py::arg("stacklevel") = 2);

This is all way above me - hopefully some C++ expert can chime in here.


[1] - https://src.fedoraproject.org/rpms/libmamba/pull-request/2

--
Orion Poplawski
he/him/his  - surely the least important thing about me
IT Systems Manager                         720-772-5637
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@xxxxxxxx
Boulder, CO 80301                 https://www.nwra.com/

--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux