Hi, I am a newer, I have some question about genode about c++ RTTI My test command is “make -C build/x86_32 KERNEL=sel4 BOARD=pc run/demo”, my genode version is “19.02” I add “typeid”, compile warning “must inclue <typeinfo>”, but this must compile add “stdcxx” lib, If add stdcxx, they need “Libc::Component::construct”, it is conflict with “Component::construct” of genode How can I resolve it, or Is there some demo support c++RTTI ? Thank you very much
Hello,
welcome to the list.
On Tue, Dec 08, 2020 at 10:39:03 CET, yadong.li wrote:
I am a newer, I have some question about genode about c++ RTTI My test command is “make -C build/x86_32 KERNEL=sel4 BOARD=pc run/demo”, my genode version is “19.02”
First, I strongly suggest you update Genode to version 20.11 esp. because we updated our tool chain with 19.05 and can longer support older versions.
I add “typeid”, compile warning “must inclue <typeinfo>”, but this must compile add “stdcxx” lib, If add stdcxx, they need “Libc::Component::construct”, it is conflict with “Component::construct” of genode How can I resolve it, or Is there some demo support c++RTTI ?
The C++ RTTI support for the core language features like dynamic_cast<>() is regularly used by the base components and works as expected. What we skipped for the base library are more complex APIs that need the C++ runtime library stdcxx. The background of this decision is that the stdcxx library comes with an axiomatic requirement on a complete working C runtime, which we do not want to provide in the base library. Therefore, components depending on high-level C++ APIs from stdcxx transitively depend on libc. Please have a look at [1] for a basic stdcxx component that states its library dependencies in target.mk as 'stdcxx' and 'posix' [2]. The latter is used to bootstrap standard C/C++ programs with a main() routine in contrast to Libc::Component::construct() used as startup hook by the libc.
Long story short: If you want to change a base component that uses the Genode base library only to a stdcxx (or libc) component, you have to replace the Component:construct() startup routine by Libc::Component::construct(). Writing this I personally get the feeling that "adding typeid" is a weak motivation for that.
[1] https://github.com/genodelabs/genode/tree/master/repos/libports/src/test/std... [2] https://github.com/genodelabs/genode/blob/master/repos/libports/src/test/std...
Regards