Skip to content

LDLIBRARY is set to libpython3.9a although no static lib is included in mambaforge for Linux #565

Closed

Description

@maxnoe

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

Compiling software, I use sysconfig.get_config_var("LDLIBRARY") to get the name of the python library.

In a fresh mambaforge installation, this variable is set to libpython3.9.a but only shared libraries are present in the lib dir:

❯ python -c 'import sysconfig; print(sysconfig.get_config_var("LDLIBRARY"))'
libpython3.9.a

❯ ls -1 ~/.local/conda/lib/libpython*
/home/mnoethe/.local/conda/lib/libpython3.9.so
/home/mnoethe/.local/conda/lib/libpython3.9.so.1.0
/home/mnoethe/.local/conda/lib/libpython3.so

Installed packages

Fresh mambaforge installation

Environment info

❯ conda info

     active environment : base
    active env location : /home/mnoethe/.local/conda
            shell level : 1
       user config file : /home/mnoethe/.condarc
 populated config files : /home/mnoethe/.local/conda/.condarc
          conda version : 4.11.0
    conda-build version : not installed
         python version : 3.9.7.final.0
       virtual packages : __linux=5.14.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/mnoethe/.local/conda  (writable)
      conda av data dir : /home/mnoethe/.local/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /home/mnoethe/.local/conda/pkgs
                          /home/mnoethe/.conda/pkgs
       envs directories : /home/mnoethe/.local/conda/envs
                          /home/mnoethe/.conda/envs
               platform : linux-64
             user-agent : conda/4.11.0 requests/2.26.0 CPython/3.9.7 Linux/5.14.0-1027-oem ubuntu/20.04.4 glibc/2.31
                UID:GID : 5074:5002
             netrc file : None
           offline mode : False

Activity

  1. isuruf commented on Mar 25, 2022

    @isuruf
    Member

    You need to install libpython-static package.

  2. maxnoe commented on Mar 25, 2022

    @maxnoe
    Author

    @isuruf I don't want to have the static lib. This is about that the python package has the wrong sysconfig variable in the metadata.

    sysconfig.get_config_var("LDLIBRARY") should point to an existing file, in this case the libpython3.9.so

  3. hmaarrfk commented on Apr 24, 2022

    @hmaarrfk
    Contributor
  4. hmaarrfk commented on Apr 24, 2022

    @hmaarrfk
    Contributor

    I'm not sure if this is something that we can work with upstream on.

    I'm not really sure what the correct behavior is:

    1. Return .so when -static isn't installed.
    2. Return .a when -static is installed

    Do we want the above?

  5. mgorny commented on Jan 15, 2026

    @mgorny
    Member

    I'm not really sure what the correct behavior is:

    1. Return `.so` when `-static` isn't installed.
    
    2. Return `.a` when `-static` is installed
    

    Do we want the above?

    I don't think so. I mean, you don't want packages to be switching between shared and static libpython based on whether libpython-static happens to be installed or not.

    Pretty much all distros (checked Arch, Debian, Gentoo and openSUSE right now) have LDLIBRARY pointing to .so. I think this is a reasonable default, given that 1) you generally want to prefer dynamic linking, and 2) it is always installed.

    FWICS Python defaults to using the shared library in _sysconfigdata_* if --enable-shared is passed. What I don't really know is whether there's a specific reason we're installing the data from the static build rather than the shared build. I'm building the packages locally to check the diff now.

  6. mgorny commented on Jan 15, 2026

    @mgorny
    Member

    Looks like most of the differences are superficial (build paths, build-time details), but some of the differences suggest that we're probably wrong to be using this data:

    -    'CFLAGSFORSHARED': '',
    +    'CFLAGSFORSHARED': '-fPIC',
    -    'INSTSONAME': 'libpython3.14.a',
    +    'INSTSONAME': 'libpython3.14.so.1.0',
    -    'Py_ENABLE_SHARED': 0,
    +    'Py_ENABLE_SHARED': 1,
  7. added 2 commits that reference this issue on Jan 15, 2026
    3ec59d6
    c237464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions