Compilation error running get_started.py: `.bss' can not be used when making a shared object; recompile with -fPIC


#1

I’m running the file get_started.py (downloaded from the “Get Started with TVM” tutorial) on Ubuntu 16.04. CMake, tvm and LLVM all appear to be installed properly. But when I run $ python get started.py, I get the following error:

I’m running the file get_started.py (downloaded from the “Get Started with TVM” tutorial) on Ubuntu 16.04. CMake, tvm and LLVM all appear to be installed properly. But when I run $ python get started.py, I get the following error:

Traceback (most recent call last): File "get_started.py", line 196, in <module> cc.create_shared(temp.relpath("myadd.so"), [temp.relpath("myadd.o")]) File "/home/users/jnakhleh/tvm/python/tvm/contrib/cc.py", line 33, in create_shared _linux_shared(output, objects, options, cc) File "/home/users/jnakhleh/tvm/python/tvm/contrib/cc.py", line 58, in _linux_shared raise RuntimeError(msg) RuntimeError: Compilation error: /usr/bin/ld: /tmp/tmpwI92Zd/myadd.o: relocation R_X86_64_32S against '.bss' can not be used when making a shared object; recompile with -fPIC /tmp/tmpwI92Zd/myadd.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status

Here is a screenshot of the output:


I have searched this error online and haven’t found any helpful explanations of what is causing this. I haven’t modified the code at all, it’s exactly how it is written for the tutorial, so it seems this may be an issue with TVM. Any help would be appreciated.


#2

There seems to already be another thread on this issue with a few proposed workarounds.