Trouble building examples on RPI4 & MacOS for Cpp

I found many similar questions.

The simplest way is modifying the following lines in apps/howto_deploy/prepare_test_libs.py


    # fadd_syslib = tvm.build(s, [A, B], "llvm", name="addonesys")
    fadd_mod = tvm.lower(s, [A, B], name="addonesys")
    from tvm.runtime import String
    fadd_mod = fadd_mod.with_attr("system_lib_prefix", String(""))

    fadd_syslib = tvm.build(fadd_mod, target="llvm", name="addonesys")

    syslib_path = os.path.join(base_path, "test_addone_sys.o")
    fadd_syslib.save(syslib_path)

The reason is that currently TVM implicitly identifies a module as “system-lib” according to whether it has the attribute system_lib_prefix. If not, the function used to register the symbols TVMBackendRegisterSystemLibSymbol won’t be included in the compiled library (“test_addone_sys.o”).

So a direct solution is to explicitly set the attribute to the IRModule lowered from te.Schedule, before the codegen process.

Hope this could help and more elegant solutions could be provided.

1 Like