k2-fsa / k2

FSA/FST algorithms, differentiable, with PyTorch compatibility.
https://k2-fsa.github.io/k2
Apache License 2.0
1.1k stars 214 forks source link

Installation error - /usr/bin/ld: final link failed: Bad value #1225

Closed RuslanSel closed 1 year ago

RuslanSel commented 1 year ago

Ubuntu 18.04, python 3.8.3, venv

python3 setup.py install [100%] Linking CUDA shared module ../../../lib/_k2.cpython-38-x86_64-linux-gnu.so /usr/bin/ld: /usr/local/lib/libpython3.8.a(_warnings.o): relocation R_X86_64_PC32 against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status k2/python/csrc/CMakeFiles/_k2.dir/build.make:556: recipe for target 'lib/_k2.cpython-38-x86_64-linux-gnu.so' failed make[2]: [lib/_k2.cpython-38-x86_64-linux-gnu.so] Error 1 CMakeFiles/Makefile2:444: recipe for target 'k2/python/csrc/CMakeFiles/_k2.dir/all' failed make[1]: [k2/python/csrc/CMakeFiles/_k2.dir/all] Error 2 Makefile:135: recipe for target 'all' failed

Thanks in advance.

csukuangfj commented 1 year ago

Please reinstall your python.

Remember to pass the option

--enable-shared

to ./configure

You have to build a shared library version of Python.

RuslanSel commented 1 year ago

Yes. It helped. Thank you!