Unable to find missing declaration for gem5::SimpleMemobjParams::create() #2121
-
Describe the bug
To Reproduce empty src/learning_gem5/part2 directory and add the following files : simple_memobj.cc :
#include "learning_gem5/part2/simple_memobj.hh" #include "base/trace.hh" namespace gem5
} // namespace gem5` simple_memobj.hh : `#ifndef SIMPLE_MEMOBJ_HH #include "mem/port.hh" namespace gem5
} // namespace gem5 #endif // SIMPLE_MEMOBJ_HH` SimpleMemobj.py : `from m5.params import * class SimpleMemobj(SimObject):
SConscript : SimObject('SimpleMemobj.py', sim_objects=['SimpleMemobj']) Source('simple_memobj.cc') DebugFlag('SimpleMemobj')` Terminal Output scons build/RISCV/gem5.opt -j20
scons: Reading SConscript files ...
Mkdir("/home/ajvendetta/arago/gem5/build/RISCV/gem5.build")
Checking for linker -Wl,--as-needed support... (cached) yes
Checking for compiler -gz support... (cached) yes
Checking for linker -gz support... (cached) yes
Info: Using Python config: python3-config
Checking for C header file Python.h... (cached) yes
Checking Python version... (cached) 3.12.7
Checking for accept(0,0,0) in C++ library None... (cached) yes
Checking for zlibVersion() in C++ library z... (cached) yes
Checking for C library tcmalloc_minimal... (cached) yes
Building in /home/ajvendetta/arago/gem5/build/RISCV
"build_tools/kconfig_base.py" "/home/ajvendetta/arago/gem5/build/RISCV/gem5.build/Kconfig" "/home/ajvendetta/arago/gem5/src/Kconfig"
Checking size of struct kvm_xsave ... (cached) yes
Checking for C header file fenv.h... (cached) yes
Checking for C header file png.h... (cached) yes
Checking for clock_nanosleep(0,0,NULL,NULL) in C library None... (cached) yes
Checking for C header file valgrind/valgrind.h... (cached) no
Checking for pkg-config package hdf5-serial... (cached) yes
Checking for H5Fcreate("", 0, 0, 0) in C library hdf5... (cached) yes
Checking for H5::H5File("", 0) in C++ library hdf5_cpp... (cached) yes
Checking for pkg-config package protobuf... (cached) yes
Checking for shm_open("/test", 0, 0) in C library None... (cached) yes
Checking for backtrace_symbols_fd((void *)1, 0, 0) in C library None... (cached) yes
Checking for C header file linux/if_tun.h... (cached) yes
Checking for C header file capstone/capstone.h... (cached) yes
Checking for C header file linux/kvm.h... (cached) yes
Checking for timer_create(CLOCK_MONOTONIC, NULL, NULL) in C library None... (cached) yes
Checking for member exclude_host in struct perf_event_attr...(cached) yes
Checking whether __i386__ is declared... (cached) no
Checking whether __x86_64__ is declared... (cached) yes
BUILD_TLM not set, not building CHI-TLM integration
Checking for compiler -Wno-self-assign-overloaded support... (cached) yes
Checking for linker -Wno-free-nonheap-object support... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
[ CXX] RISCV/python/_m5/param_SimpleMemobj.cc -> .o
[ CXX] src/learning_gem5/part2/simple_memobj.cc -> RISCV/learning_gem5/part2/simple_memobj.o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_two_level/dma_controller.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_two_level/l1_cache.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_two_level/l2_cache.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_three_level/directory.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_three_level/l1_cache.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_three_level/l3_cache.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/__init__.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/core_complex.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/ruby_network_components.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mi_example/directory.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mi_example/dma_controller.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_three_level/l2_cache.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/octopi.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mi_example/__init__.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_three_level/dma_controller.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/octopi_cache/octopi_network.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/prebuilt/__init__.py.cc -> .o
[ CXX] RISCV/python/gem5/components/cachehierarchies/ruby/caches/mesi_three_level/__init__.py.cc -> .o
src/learning_gem5/part2/simple_memobj.cc:237:1: error: no declaration matches ‘gem5::SimpleMemobj* gem5::SimpleMemobjParams::create() const’
237 | SimpleMemobjParams::create() const
| ^~~~~~~~~~~~~~~~~~
In file included from src/learning_gem5/part2/simple_memobj.hh:6,
from src/learning_gem5/part2/simple_memobj.cc:31:
build/RISCV/params/SimpleMemobj.hh:19:20: note: candidate is: ‘SimpleMemobj* gem5::SimpleMemobjParams::create() const’
19 | SimpleMemobj * create() const;
| ^~~~~~
build/RISCV/params/SimpleMemobj.hh:16:8: note: ‘struct gem5::SimpleMemobjParams’ defined here
16 | struct SimpleMemobjParams
| ^~~~~~~~~~~~~~~~~~
scons: *** [build/RISCV/learning_gem5/part2/simple_memobj.o] Error 1
build/RISCV/python/_m5/param_SimpleMemobj.cc:110:1: error: no declaration matches ‘gem5::SimpleMemobj* gem5::SimpleMemobjParams::create() const’
110 | DummySimpleMemobjShunt<SimpleMemobj>::Params::create() const
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from build/RISCV/python/_m5/param_SimpleMemobj.cc:13:
build/RISCV/params/SimpleMemobj.hh:19:20: note: candidate is: ‘SimpleMemobj* gem5::SimpleMemobjParams::create() const’
19 | SimpleMemobj * create() const;
| ^~~~~~
build/RISCV/params/SimpleMemobj.hh:16:8: note: ‘struct gem5::SimpleMemobjParams’ defined here
16 | struct SimpleMemobjParams
| ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3898,
from /usr/include/c++/14/math.h:36,
from /usr/include/python3.12/pyport.h:195,
from /usr/include/python3.12/Python.h:38,
from ext/pybind11/include/pybind11/detail/../detail/common.h:266,
from ext/pybind11/include/pybind11/detail/../attr.h:13,
from ext/pybind11/include/pybind11/detail/class.h:12,
from ext/pybind11/include/pybind11/pybind11.h:13,
from build/RISCV/python/_m5/param_SimpleMemobj.cc:7:
/usr/include/c++/14/type_traits: In instantiation of ‘struct std::is_base_of<pybind11::detail::pyobject_tag, SimpleMemobj>’:
/usr/include/c++/14/type_traits:1493:30: recursively required by substitution of ‘template<class T> class pybind11::detail::type_caster<T, typename std::enable_if<std::is_base_of<pybind11::detail::pyobject_tag, typename std::remove_reference<_Tp>::type>::value, void>::type> [with T = SimpleMemobj]’
1493 | : public __bool_constant<__is_base_of(_Base, _Derived)>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ext/pybind11/include/pybind11/pybind11.h:241:63: recursively required by substitution of ‘template<class Return> struct pybind11::detail::return_value_policy_override<Return, typename std::enable_if<std::is_base_of<pybind11::detail::type_caster_generic, pybind11::detail::type_caster<typename pybind11::detail::intrinsic_type<T>::type> >::value, void>::type> [with Return = SimpleMemobj*]’
241 | = return_value_policy_override<Return>::policy(call.func.policy);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
ext/pybind11/include/pybind11/pybind11.h:241:63: required from ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function<SimpleMemobj*, gem5::SimpleMemobjParams, pybind11::name, pybind11::is_method, pybind11::sibling>(SimpleMemobj* (gem5::SimpleMemobjParams::*)() const, const pybind11::name&, const pybind11::is_method&, const pybind11::sibling&)::<lambda(const gem5::SimpleMemobjParams*)>; Return = SimpleMemobj*; Args = {const gem5::SimpleMemobjParams*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]’
ext/pybind11/include/pybind11/pybind11.h:131:19: required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...) const, const Extra& ...) [with Return = SimpleMemobj*; Class = gem5::SimpleMemobjParams; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]’
131 | initialize([f](const Class *c,
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
132 | Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 | (Return(*)(const Class *, Arg...)) nullptr,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134 | extra...);
| ~~~~~~~~~
ext/pybind11/include/pybind11/pybind11.h:1583:22: required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = SimpleMemobj* (gem5::SimpleMemobjParams::*)() const; Extra = {}; type_ = gem5::SimpleMemobjParams; options = {gem5::SimObjectParams, std::unique_ptr<gem5::SimpleMemobjParams, pybind11::nodelete>}]’
1583 | cpp_function cf(method_adaptor<type>(std::forward<Func>(f)),
| ^~
build/RISCV/python/_m5/param_SimpleMemobj.cc:30:13: required from here
28 | py::class_<SimpleMemobjParams, SimObjectParams, std::unique_ptr<SimpleMemobjParams, py::nodelete>>(m, "SimpleMemobjParams")
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 | .def(py::init<>())
| ~~~~~~~~~~~~~~~~~~
30 | .def("create", &SimpleMemobjParams::create)
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:1493:30: error: invalid use of incomplete type ‘class SimpleMemobj’
1493 | : public __bool_constant<__is_base_of(_Base, _Derived)>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/RISCV/params/SimpleMemobj.hh:10:7: note: forward declaration of ‘class SimpleMemobj’
10 | class SimpleMemobj;
| ^~~~~~~~~~~~
In file included from ext/pybind11/include/pybind11/detail/../cast.h:14,
from ext/pybind11/include/pybind11/detail/../attr.h:14:
ext/pybind11/include/pybind11/detail/../detail/descr.h: In instantiation of ‘static constexpr std::array<const std::type_info*, (sizeof... (Ts) + 1)> pybind11::detail::descr<N, Ts>::types() [with long unsigned int N = 10; Ts = {gem5::SimpleMemobjParams, SimpleMemobj}]’:
ext/pybind11/include/pybind11/pybind11.h:292:73: required from ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function<SimpleMemobj*, gem5::SimpleMemobjParams, pybind11::name, pybind11::is_method, pybind11::sibling>(SimpleMemobj* (gem5::SimpleMemobjParams::*)() const, const pybind11::name&, const pybind11::is_method&, const pybind11::sibling&)::<lambda(const gem5::SimpleMemobjParams*)>; Return = SimpleMemobj*; Args = {const gem5::SimpleMemobjParams*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]’
292 | PYBIND11_DESCR_CONSTEXPR auto types = decltype(signature)::types();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
ext/pybind11/include/pybind11/pybind11.h:131:19: required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...) const, const Extra& ...) [with Return = SimpleMemobj*; Class = gem5::SimpleMemobjParams; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]’
131 | initialize([f](const Class *c,
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
132 | Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 | (Return(*)(const Class *, Arg...)) nullptr,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134 | extra...);
| ~~~~~~~~~
ext/pybind11/include/pybind11/pybind11.h:1583:22: required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = SimpleMemobj* (gem5::SimpleMemobjParams::*)() const; Extra = {}; type_ = gem5::SimpleMemobjParams; options = {gem5::SimObjectParams, std::unique_ptr<gem5::SimpleMemobjParams, pybind11::nodelete>}]’
1583 | cpp_function cf(method_adaptor<type>(std::forward<Func>(f)),
| ^~
build/RISCV/python/_m5/param_SimpleMemobj.cc:30:13: required from here
28 | py::class_<SimpleMemobjParams, SimObjectParams, std::unique_ptr<SimpleMemobjParams, py::nodelete>>(m, "SimpleMemobjParams")
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 | .def(py::init<>())
| ~~~~~~~~~~~~~~~~~~
30 | .def("create", &SimpleMemobjParams::create)
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ext/pybind11/include/pybind11/detail/../detail/descr.h:40:19: error: invalid use of incomplete type ‘class SimpleMemobj’
40 | return {{&typeid(Ts)..., nullptr}};
| ^~~~~~~~~~
build/RISCV/params/SimpleMemobj.hh:10:7: note: forward declaration of ‘class SimpleMemobj’
10 | class SimpleMemobj;
| ^~~~~~~~~~~~
ext/pybind11/include/pybind11/detail/../detail/descr.h:40:42: error: could not convert ‘{{<expression error>, nullptr}}’ from ‘<brace-enclosed initializer list>’ to ‘std::array<const std::type_info*, 3>’
40 | return {{&typeid(Ts)..., nullptr}};
| ^
| |
| <brace-enclosed initializer list>
ext/pybind11/include/pybind11/pybind11.h: In instantiation of ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function<SimpleMemobj*, gem5::SimpleMemobjParams, pybind11::name, pybind11::is_method, pybind11::sibling>(SimpleMemobj* (gem5::SimpleMemobjParams::*)() const, const pybind11::name&, const pybind11::is_method&, const pybind11::sibling&)::<lambda(const gem5::SimpleMemobjParams*)>; Return = SimpleMemobj*; Args = {const gem5::SimpleMemobjParams*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]’:
ext/pybind11/include/pybind11/pybind11.h:131:19: required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...) const, const Extra& ...) [with Return = SimpleMemobj*; Class = gem5::SimpleMemobjParams; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling}]’
131 | initialize([f](const Class *c,
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
132 | Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 | (Return(*)(const Class *, Arg...)) nullptr,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134 | extra...);
| ~~~~~~~~~
ext/pybind11/include/pybind11/pybind11.h:1583:22: required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = SimpleMemobj* (gem5::SimpleMemobjParams::*)() const; Extra = {}; type_ = gem5::SimpleMemobjParams; options = {gem5::SimObjectParams, std::unique_ptr<gem5::SimpleMemobjParams, pybind11::nodelete>}]’
1583 | cpp_function cf(method_adaptor<type>(std::forward<Func>(f)),
| ^~
build/RISCV/python/_m5/param_SimpleMemobj.cc:30:13: required from here
28 | py::class_<SimpleMemobjParams, SimObjectParams, std::unique_ptr<SimpleMemobjParams, py::nodelete>>(m, "SimpleMemobjParams")
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 | .def(py::init<>())
| ~~~~~~~~~~~~~~~~~~
30 | .def("create", &SimpleMemobjParams::create)
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ext/pybind11/include/pybind11/pybind11.h:292:73: in ‘constexpr’ expansion of ‘pybind11::detail::descr<10, gem5::SimpleMemobjParams, SimpleMemobj>::types()’
ext/pybind11/include/pybind11/pybind11.h:292:73: error: ‘constexpr’ call flows off the end of the function
292 | PYBIND11_DESCR_CONSTEXPR auto types = decltype(signature)::types();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
scons: *** [build/RISCV/python/_m5/param_SimpleMemobj.o] Error 1
scons: building terminated because of errors. Additional information |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should remove the definition of the |
Beta Was this translation helpful? Give feedback.
You should remove the definition of the
create()
function from your code and instead usePARAMS(<your sim object>)
. This changed a few versions ago. See https://github.com/gem5/gem5/tree/stable/src/learning_gem5/part2 for up-to-date code.