Skip to content

I cannot create shared object. #2300

@were

Description

@were

When I am working on #2287 , I got a CPU check failure.
I want to replicate the problem locally so that I can fix it.

python3 tvm/tests/python/unittest/test_module_load.py

What I got is:

Traceback (most recent call last):
  File "test_module_load.py", line 198, in <module>
    test_combine_module_llvm()
  File "test_module_load.py", line 192, in test_combine_module_llvm
    check_system_lib()
  File "test_module_load.py", line 179, in check_system_lib
    cc.create_shared(path_dso, [path1, path2])
  File "~/tvm/python/tvm/contrib/cc.py", line 33, in create_shared
    _linux_shared(output, objects, options, cc)
  File "~/tvm/python/tvm/contrib/cc.py", line 59, in _linux_shared
    raise RuntimeError(msg)
RuntimeError: Compilation error:
/usr/bin/ld: /tmp/tmpcOcGRh/myadd1.o: relocation R_X86_64_32S against `.rodata.cst4' can not be used when making a shared object; recompile with -fPIC
/tmp/tmpcOcGRh/myadd1.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

and I followed this stackoverflow to see if .os are compiled with -fPIC.
https://stackoverflow.com/questions/19768267/relocation-r-x86-64-32s-against-linking-error
which shows that .os are compiled properly with -fPIC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions