Error building Dynamic Library


#1

I am trying to go through the how to deploy example for our environment (https://docs.tvm.ai/deploy/cpp_deploy.html). I am able to build System module but ran into issues building Dynamic library.
We are cross compiling on x86_64 for 32 bit arm. I have verified the target triple (using the --verbose with compiler). Am I missing something?

Traceback (most recent call last):
  File "prepare_test_libs.py", line 38, in <module>
    prepare_test_libs(os.path.join(curr_path, "./lib"))
  File "prepare_test_libs.py", line 29, in prepare_test_libs
    fadd_dylib.export_library(dylib_path)
  File "/home/tvm/python/tvm/module.py", line 144, in export_library
    fcompile(file_name, files, **kwargs)
  File "/home/tvm/python/tvm/contrib/cc.py", line 49, in create_shared
    _linux_shared(output, objects, options, cc)
  File "/home/tvm/python/tvm/contrib/cc.py", line 106, in _linux_shared
    raise RuntimeError(msg)
RuntimeError: Compilation error:
/usr/bin/ld: /tmp/tmps1cxjn7i/lib.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: /tmp/tmps1cxjn7i/lib.o: Relocations in generic ELF (EM: 40)
/tmp/tmps1cxjn7i/lib.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status

#2

What did you change the target to in the deploy script?


#3

For Dynamic

fadd_dylib = tvm.build(s, [A, B], "llvm -target=arm-linux-gnueabihf", name="addone")

and System module

fadd_syslib = tvm.build(s, [A, B], "llvm --system-lib -target=arm-linux-gnueabihf", name="addonesys")