Tvm: Cross-Compilation error: error adding symbols: File in wrong format

Created on 24 Aug 2017  路  6Comments  路  Source: apache/tvm

Env.

  • remote device: fireflyRK3399, ARM A72, built runtime previously
  • local machine: i7-3630, built tvm previously

config.mk

  • remote device
DEBUG = 1
USE_OPENCL = 1 # installed opencl previousl
USE_RPC = 1
USE_BLAS = openblas
  • local machine
DEBUG = 1
USE_OPENCL = 1 # installed opencl previously
LLVM_CONFIG = llvm-config
USE_BLAS = openblas

Remote Device (ARM A72)

yuanshuai@firefly:~$ python -m tvm.exec.rpc_server --host 0.0.0.0 --port=9090
Loading runtime library /home/yuanshuai/code/tvm/lib/libtvm_runtime.so... exec only
INFO:root:RPCServer: bind to 0.0.0.0:9090
INFO:root:RPCServer: connection from ('192.168.1.110', 60482)
INFO:root:Connection from ('192.168.1.110', 60482)
[01:34:55] src/runtime/rpc/rpc_server_env.cc:23: Upload /tmp/tmp0gxCni/mylib.o... nbytes=4280
INFO:root:Create shared library based on /tmp/tmp0gxCni/mylib.o

Local Machine

yuens@Spark:~/Software/tvm/tutorials/python$ python cross_compilation_and_rpc.py                                                                                                                                                                                                                                         [2/30]
Traceback (most recent call last):
  File "cross_compilation_and_rpc.py", line 189, in <module>
    f = remote.load_module('mylib.o')
  File "/home/yuens/Software/tvm/python/tvm/contrib/rpc.py", line 299, in load_module
    return _LoadRemoteModule(self._sess, path)
  File "/home/yuens/Software/tvm/python/tvm/_ffi/function.py", line 255, in my_api_func
    return flocal(*args)
  File "/home/yuens/Software/tvm/python/tvm/_ffi/_ctypes/function.py", line 183, in __call__
    ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
  File "/home/yuens/Software/tvm/python/tvm/_ffi/base.py", line 62, in check_call
    raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: Except caught from RPC call: TVMCall CFunc Error:
Traceback (most recent call last):
  File "/home/yuanshuai/code/tvm/python/tvm/_ffi/_ctypes/function.py", line 54, in cfun
    rv = local_pyfunc(*pyargs)
  File "/home/yuanshuai/code/tvm/python/tvm/contrib/rpc.py", line 42, in load_module
    cc.create_shared(path + '.so', path)
  File "/home/yuanshuai/code/tvm/python/tvm/contrib/cc.py", line 52, in create_shared
    raise RuntimeError(msg)
RuntimeError: Compilation error:
/usr/bin/ld: /tmp/tmp0gxCni/mylib.o: Relocations in generic ELF (EM: 62)
/usr/bin/ld: /tmp/tmp0gxCni/mylib.o: Relocations in generic ELF (EM: 62)
/tmp/tmp0gxCni/mylib.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status

Most helpful comment

try to do gcc -v on the board to see the target triple you have

All 6 comments

could because you used the wrong target triple

try to do gcc -v on the board to see the target triple you have

Successful cross-compilation and some notes below:

According to tutorial Cross Compilation and RPC
, I edit this line f = tvm.build(s, [A, B], target='llvm -target=aarch64-linux-gnu', name='myadd') in cross_compilation_and_rpc.py on local machine using matched target value. Check matched target value using gcc -v on remote device (board).

successful message on board

yuanshuai@firefly:~$ python -m tvm.exec.rpc_server --host 0.0.0.0 --port=9090
Loading runtime library /home/yuanshuai/code/tvm/lib/libtvm_runtime.so... exec only
INFO:root:RPCServer: bind to 0.0.0.0:9090
INFO:root:RPCServer: connection from ('192.168.1.110', 33898)
INFO:root:Connection from ('192.168.1.110', 33898)
[02:12:11] src/runtime/rpc/rpc_server_env.cc:23: Upload /tmp/tmpWg05yI/mylib.o... nbytes=5096
INFO:root:Create shared library based on /tmp/tmpWg05yI/mylib.o
INFO:root:load_module /tmp/tmpWg05yI/mylib.o.so
[02:12:11] src/runtime/rpc/rpc_session.cc:751: Shutdown...
INFO:root:Finish serving ('192.168.1.110', 33898)

successful message on local machine

yuens@Spark:~/Software/tvm/tutorials/python$ python cross_compilation_and_rpc.py 
[10:12:11] src/codegen/llvm/codegen_llvm.cc:75: set native vector to be 32 for target aarch64
2.65708e-05 secs/op

Also note that if you want to do CPU testing, it might make sense to add detailed target options, for example

-mattr=+neon

to enable neon support

@tqchen Get!

issue:
xilinx@pynq:~$ cd tvm
xilinx@pynq:~/tvm$ sudo ./apps/pynq_rpc/start_rpc_server.sh
[sudo] password for xilinx:
INFO:RPCServer:bind to 0.0.0.0:9091
INFO:RPCServer:connection from ('192.168.2.1', 55278)
INFO:RPCServer:Finish serving ('192.168.2.1', 55278)
INFO:RPCServer:connection from ('192.168.2.1', 55285)
INFO:root:Loading VTA library: /home/xilinx/tvm/vta/python/vta/../../../build/libvta.so
INFO:RPCServer:Finish serving ('192.168.2.1', 55285)
INFO:RPCServer:connection from ('192.168.2.1', 55296)
INFO:RPCServer:Finish serving ('192.168.2.1', 55296)

can you tell me why? I do not connnect my PRC.

Was this page helpful?
0 / 5 - 0 ratings