genodelabs / genode

Genode OS Framework
https://genode.org/
Other
1.07k stars 252 forks source link

gdb_monitor: build error with gcc 12 #4841

Closed cproc closed 1 year ago

cproc commented 1 year ago

When building app/gdb_monitor with gcc 12, the following error occurs:

In file included from /.../repos/ports/src/app/gdb_monitor/genode_child_resources.h:17,
                 from /.../repos/ports/src/app/gdb_monitor/cpu_session_component.h:30,
                 from /.../repos/ports/src/app/gdb_monitor/cpu_session_component.cc:18:
/.../repos/ports/src/app/gdb_monitor/region_map_component.h:45:47: error: 'struct Genode::Avl_node<Genode::Object_pool<Genode::Rpc_object_base>::Entry> Genode::Avl_node<Genode::Object_pool<Genode::Rpc_object_base>::Entry>::Avl_node' is inaccessible within this context
   45 |                         class Region : public Avl_node<Region>
      |                                               ^~~~~~~~~~~~~~~~
In file included from /.../repos/base/include/base/id_space.h:22,
                 from /.../repos/base/include/parent/parent.h:21,
                 from /.../repos/base/include/base/env.h:17,
                 from /.../repos/ports/src/app/gdb_monitor/cpu_session_component.cc:15:
/.../repos/base/include/util/avl_tree.h:153:1: note: declared here
  153 | {
      | ^

Unfortunately I haven't figured out yet what exactly is inaccessible and how to fix it.

cproc commented 1 year ago

git bisect found the GCC commit from [1]. I'm going to try to reproduce the error with a simpler test case.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100918

cproc commented 1 year ago

It turned out that class Region : public Avl_node<Region> does not get resolved to the Avl_node template from avl_tree.h by default, but to the private Avl_node<Entry> base class of Object_pool::Entry instead. Fixed by 6ba5cac.