[SOLVED] Build for ARM host

Hi,

I would like to use relay compiler to build for ARM host. The target device is also ARM. for X86 (target=“llvm”) I can easily use

export_library(lib_export_path)

I get a .so which can be loaded by runtime to create an executor factory.

For ARM, I build with target=“llvm -mtriple=aarch64-linux-gnu”, I can then export to a tar file, where I have 2 object files.

I get a linker (ld) error when trying to export to .so though.

do I need to do something like this:(?)

cross_compile = 'aarch64-linux-gnu-c++'

lib.export_library(lib_export_path, cc=cross_compile)

I did not check since I don’t have the ARM toolchain installed so it would fail. I assumed that it should work since llvm compiled to ops to ARM object files.

Thanks for the help

edit: [SOLVED] I saw that I have to pass ‘fcompile’ to the export library to cross compile. I then had a linker issue regarding where it searched for libs. The solution was to use the ‘–sysroot’ flag as an option to the export_library function.

so something like this:

options = ["-shared", "-fPIC", "-lm", "--sysroot=relevant/sysroot"]

lib.export_library(lib_name, ndk.create_shared, options=options)

and in addition I had to define TVM_NDK_CC env variable to point to my cross compiler