TVM AOT C+BYOC compilation fails with `expected str but got Object`

Followed some of the tracing tips above (just logging, rather than gdb), and found a similar path of my issue.

In metadata_module.cc, in some cases auto pf_sym = mod.GetFunction("get_symbol"); was returning a pf_sym != nullptr, which caused my error to appear.

I think I fixed it by replacing:

return (*pf)(code, "c", Array<String>{func_names_}, const_names_);`

In my BYOC Finalize() function with:

return codegen::CSourceModuleCreate(code, "c", Array<String>{func_names_});

This did require adding an include #include "../../../../target/source/codegen_c_host.h"