Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1116

Unbreak network facts resolver on BSD

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: FACT 3.0.1
    • Fix Version/s: FACT 3.1.0
    • Component/s: Community
    • Labels:
      None
    • Environment:

      OpenBSD 5.8
      GCC 4.9.2

    • Template:
    • Story Points:
      1
    • Sprint:
      Client 2015-08-05
    • Release Notes:
      Not Needed

      Description

      I'm trying to build the `bsd/network_resolver.cc` on OpenBSD, however it's failing like this:

      FAILED: /usr/local/bin/ccache  eg++  -DBOOST_ALL_DYN_LINK -DBOOST_LOG_WITHOUT_WCHAR_T -DLEATHERMAN_LOGGING_NAMESPACE=\"puppetlabs.facter\" -DUSE_OPENSSL -DUSE_POSIX_FUNCTIONS -DUSE_YAMLCPP -O2 -pipe    -Wno-maybe-uninitialized -std=c++11 -Wall -Werror -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-unknown-pragmas -Wno-missing-field-initializers -Wextra -DNDEBUG -fPIC -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/rapidjson-0.11/include -I/usr/local/include -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/leatherman/vendor/boost-nowide -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/leatherman/locale/inc -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/leatherman/logging/inc -MMD -MT lib/CMakeFiles/libfactersrc.dir/src/facts/bsd/collection.cc.o -MF lib/CMakeFiles/libfactersrc.dir/src/facts/bsd/collection.cc.o.d -o lib/CMakeFiles/libfactersrc.dir/src/facts/bsd/collection.cc.o -c /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc
      In file included from /usr/local/include/c++/4.9.2/x86_64-unknown-openbsd5.8/bits/c++allocator.h:33:0,
                       from /usr/local/include/c++/4.9.2/bits/allocator.h:46,
                       from /usr/local/include/c++/4.9.2/vector:61,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/facter/facts/resolver.hpp:8,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/facter/facts/collection.hpp:7,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:1:
      /usr/local/include/c++/4.9.2/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = facter::facts::bsd::networking_resolver; _Args = {}; _Tp = facter::facts::bsd::networking_resolver]':
      /usr/local/include/c++/4.9.2/bits/alloc_traits.h:253:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Args = {}; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]'
      /usr/local/include/c++/4.9.2/bits/alloc_traits.h:399:57:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Args = {}; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr_base.h:516:38:   required from 'std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = facter::facts::bsd::networking_resolver; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]'
      /usr/local/include/c++/4.9.2/ext/new_allocator.h:120:4:   required from 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::_Sp_counted_ptr_inplace<facter::facts::bsd::networking_resolver, std::allocator<facter::facts::bsd::networking_resolver>, (__gnu_cxx::_Lock_policy)2u>; _Args = {const std::allocator<facter::facts::bsd::networking_resolver>}; _Tp = std::_Sp_counted_ptr_inplace<facter::facts::bsd::networking_resolver, std::allocator<facter::facts::bsd::networking_resolver>, (__gnu_cxx::_Lock_policy)2u>]'
      /usr/local/include/c++/4.9.2/bits/alloc_traits.h:253:4:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
      /usr/local/include/c++/4.9.2/bits/shared_ptr_base.h:620:37:   required from 'std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr_base.h:1090:35:   required from 'std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}; _Tp = facter::facts::bsd::networking_resolver; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr.h:316:64:   required from 'std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}; _Tp = facter::facts::bsd::networking_resolver]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr.h:588:39:   required from 'std::shared_ptr<_Tp1> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr.h:604:42:   required from 'std::shared_ptr<_Tp1> std::make_shared(_Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Args = {}]'
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:26:44:   required from here
      /usr/local/include/c++/4.9.2/ext/new_allocator.h:120:4: error: invalid new-expression of abstract class type 'facter::facts::bsd::networking_resolver'
        { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
          ^
      In file included from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:5:0:
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/networking_resolver.hpp:16:12: note:   because the following virtual functions are pure within 'facter::facts::bsd::networking_resolver':
           struct networking_resolver : posix::networking_resolver
                  ^
      In file included from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/networking_resolver.hpp:7:0,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:5:
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/../posix/networking_resolver.hpp:31:22: note: 	virtual bool facter::facts::posix::networking_resolver::is_link_address(const sockaddr*) const
               virtual bool is_link_address(sockaddr const* addr) const = 0;
                            ^
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/../posix/networking_resolver.hpp:38:32: note: 	virtual const uint8_t* facter::facts::posix::networking_resolver::get_link_address_bytes(const sockaddr*) const
               virtual uint8_t const* get_link_address_bytes(sockaddr const* addr) const = 0;
                                      ^
      In file included from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:5:0:
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/networking_resolver.hpp:32:43: note: 	virtual boost::optional<long long unsigned int> facter::facts::bsd::networking_resolver::get_link_mtu(const string&, void*) const
               virtual boost::optional<uint64_t> get_link_mtu(std::string const& interface, void* data) const = 0;
                                                 ^
      ninja: build stopped: subcommand failed.
      

      So `bsd/networking_resolver.hpp` has a virtual declaration for get_link_mtu() and `posix/networking_resolver.hpp` has them for is_link_address() and get_link_address()

      Their implementations are missing from `bsd/networking_resolver.cc` right now so, so I cooked up this patch which allows `bsd/networking_resolver.cc` to compile.

      However compiling `bsd/collection.cc` still leads to:

      FAILED: /usr/local/bin/ccache  eg++  -DBOOST_ALL_DYN_LINK -DBOOST_LOG_WITHOUT_WCHAR_T -DLEATHERMAN_LOGGING_NAMESPACE=\"puppetlabs.facter\" -DUSE_OPENSSL -DUSE_POSIX_FUNCTIONS -DUSE_YAMLCPP -O2 -pipe    -Wno-maybe-uninitialized -std=c++11 -Wall -Werror -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-unknown-pragmas -Wno-missing-field-initializers -Wextra -DNDEBUG -fPIC -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/rapidjson-0.11/include -I/usr/local/include -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/leatherman/vendor/boost-nowide -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/leatherman/locale/inc -I/usr/obj/ports/facter-3.0.1/facter-3.0.1/vendor/leatherman/logging/inc -MMD -MT lib/CMakeFiles/libfactersrc.dir/src/facts/bsd/collection.cc.o -MF lib/CMakeFiles/libfactersrc.dir/src/facts/bsd/collection.cc.o.d -o lib/CMakeFiles/libfactersrc.dir/src/facts/bsd/collection.cc.o -c /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc
      In file included from /usr/local/include/c++/4.9.2/x86_64-unknown-openbsd5.8/bits/c++allocator.h:33:0,
                       from /usr/local/include/c++/4.9.2/bits/allocator.h:46,
                       from /usr/local/include/c++/4.9.2/vector:61,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/facter/facts/resolver.hpp:8,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/facter/facts/collection.hpp:7,
                       from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:1:
      /usr/local/include/c++/4.9.2/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = facter::facts::bsd::networking_resolver; _Args = {}; _Tp = facter::facts::bsd::networking_resolver]':
      /usr/local/include/c++/4.9.2/bits/alloc_traits.h:253:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Args = {}; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]'
      /usr/local/include/c++/4.9.2/bits/alloc_traits.h:399:57:   required from 'static decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Args = {}; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; decltype (_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = <type error>]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr_base.h:516:38:   required from 'std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {}; _Tp = facter::facts::bsd::networking_resolver; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]'
      /usr/local/include/c++/4.9.2/ext/new_allocator.h:120:4:   required from 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::_Sp_counted_ptr_inplace<facter::facts::bsd::networking_resolver, std::allocator<facter::facts::bsd::networking_resolver>, (__gnu_cxx::_Lock_policy)2u>; _Args = {const std::allocator<facter::facts::bsd::networking_resolver>}; _Tp = std::_Sp_counted_ptr_inplace<facter::facts::bsd::networking_resolver, std::allocator<facter::facts::bsd::networking_resolver>, (__gnu_cxx::_Lock_policy)2u>]'
      /usr/local/include/c++/4.9.2/bits/alloc_traits.h:253:4:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
      /usr/local/include/c++/4.9.2/bits/shared_ptr_base.h:620:37:   required from 'std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr_base.h:1090:35:   required from 'std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}; _Tp = facter::facts::bsd::networking_resolver; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2u]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr.h:316:64:   required from 'std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}; _Tp = facter::facts::bsd::networking_resolver]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr.h:588:39:   required from 'std::shared_ptr<_Tp1> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Alloc = std::allocator<facter::facts::bsd::networking_resolver>; _Args = {}]'
      /usr/local/include/c++/4.9.2/bits/shared_ptr.h:604:42:   required from 'std::shared_ptr<_Tp1> std::make_shared(_Args&& ...) [with _Tp = facter::facts::bsd::networking_resolver; _Args = {}]'
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:26:44:   required from here
      /usr/local/include/c++/4.9.2/ext/new_allocator.h:120:4: error: invalid new-expression of abstract class type 'facter::facts::bsd::networking_resolver'
        { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
          ^
      In file included from /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/src/facts/bsd/collection.cc:5:0:
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/networking_resolver.hpp:16:12: note:   because the following virtual functions are pure within 'facter::facts::bsd::networking_resolver':
           struct networking_resolver : posix::networking_resolver
                  ^
      /usr/obj/ports/facter-3.0.1/facter-3.0.1/lib/inc/internal/facts/bsd/networking_resolver.hpp:32:43: note: 	virtual boost::optional<long long unsigned int> facter::facts::bsd::networking_resolver::get_link_mtu(const string&, void*) const
               virtual boost::optional<uint64_t> get_link_mtu(std::string const& interface, void* data) const = 0;
      

      Michael Smith, Peter Huene any glorious ideas again this time?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jasper Jasper Lievisse Adriaanse
              QA Contact:
              Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support