Skip to content

rpath with $ORIGIN not followed when load binary modules  #115028

@galaxy001

Description

@galaxy001

Bug report

Bug description:

In a conda environment, many library files are not in default path, and conda use rpath with $ORIGIN to instruct ld.so to find .so files.

However, when a python module come with .so files, python cannot use $ORIGIN of a .so file to load its dependence.

python3 -c 'import pandas;' failed as "ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /share/home/uuu/micromamba/envs/n311/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-x86_64-linux-gnu.so)"

LD_LIBRARY_PATH=/share/home/uuu/micromamba/envs/n311/lib python3 -c 'import pandas;' works.

(n311) [uuu@c001 test]$ echo $LD_LIBRARY_PATH

(n311) [uuu@c001 test]$ ldd /share/home/uuu/micromamba/envs/n311/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-x86_64-linux-gnu.so
        linux-vdso.so.1 (0x00007fff65a6d000)
        libstdc++.so.6 => /share/home/uuu/micromamba/envs/n311/lib/python3.11/site-packages/pandas/_libs/window/../../../../../libstdc++.so.6 (0x00007f77ec0d8000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f77ebd56000)
        libgcc_s.so.1 => /share/home/uuu/micromamba/envs/n311/lib/python3.11/site-packages/pandas/_libs/window/../../../../../libgcc_s.so.1 (0x00007f77ec469000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f77eb991000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f77eb789000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f77ec2bb000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f77eb569000)

$ readelf -d /share/home/uuu/micromamba/envs/n311/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-x86_64-linux-gnu.so

Dynamic section at offset 0x50778 contains 28 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../../../../..]

$ readelf -d /share/home/uuu/micromamba/envs/n311/bin/python3

Dynamic section at offset 0x44a230 contains 34 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib]

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions