ragul rangarajan
ragul rangarajan

Reputation: 317

/usr/bin/ld: cannot find -lpython3.6m

I am trying to install bitarray using pip which fails during linking libpython.

  Downloading https://repo/api/pypi/python/packages/packages/eb/fd/bf67cfea810305148ab8a1e8fbdcc5179f56979c73907fec9a36ebd4a58a/bitarray-1.2.0.tar.gz (48kB)
Installing collected packages: bitarray
    Running setup.py install for bitarray: started
    Running setup.py install for bitarray: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /opt/rp/python-3.6.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-80tjlaa0/bitarray/setup.py'"'"'; __file__='"'"'/tmp/pip-install-80tjlaa0/bitarray/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lr_6fezd/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-80tjlaa0/bitarray/
    Complete output (19 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/bitarray
    copying bitarray/__init__.py -> build/lib.linux-x86_64-3.6/bitarray
    copying bitarray/test_bitarray.py -> build/lib.linux-x86_64-3.6/bitarray
    copying bitarray/test_util.py -> build/lib.linux-x86_64-3.6/bitarray
    copying bitarray/util.py -> build/lib.linux-x86_64-3.6/bitarray
    running build_ext
    building 'bitarray._bitarray' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/bitarray
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O -m64 -fPIC -I/opt/rp/python-3.6.9/include/python3.6m -c bitarray/_bitarray.c -o build/temp.linux-x86_64-3.6/bitarray/_bitarray.o
    gcc -pthread -shared -m64 -Wl,-R/home/jenkins/workspace/python-centos7/python-3.6.9/lib,-R/opt/rp/mysql/lib build/temp.linux-x86_64-3.6/bitarray/_bitarray.o -L/home/jenkins/workspace/centos7/python-3.6.9/lib -lpython3.6m -o build/lib.linux-x86_64-3.6/bitarray/_bitarray.cpython-36m-x86_64-linux-gnu.so
    /usr/bin/ld: cannot find -lpython3.6m
    collect2: error: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /opt/alu-rp/python-3.6.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-80tjlaa0/bitarray/setup.py'"'"'; __file__='"'"'/tmp/pip-install-80tjlaa0/bitarray/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lr_6fezd/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

But I could see the Libpython.so files

/opt/rp/python-3.6.9/lib/libpython3.6m.so.1.0
/opt/rp/python-3.6.9/lib/libpython3.6m.so
/opt/rp/python-3.6.9/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a

And my $LD_LIBRARY_PATH is /opt/rp/python-3.6.9/lib:/opt/rp/mysql/lib:/opt/rp/python-3.6.9/lib:/opt/rp/mysql/lib.

How to link the libpython to make the installation complete

Upvotes: 4

Views: 7633

Answers (2)

ragul rangarajan
ragul rangarajan

Reputation: 317

I tried with all approach that I got but nothing solved the issue.

Solved: Soft linked the libpython3.6m.so to one of the default LD_LIBRARY_PATH.

Upvotes: 1

Jelmer
Jelmer

Reputation: 1095

I think you need to include the directory with libpython3.6m.so in LIBRARY_PATH as well as LD_LIBRARY_PATH. The former is searched at link time. The latter at run time.

Upvotes: 3

Related Questions