Skip to content

Installation broken on alpine 3.14 #290

Closed

Description

@apatrushev

musl detection

return sysconfig.get_config_var('HOST_GNU_TYPE') == 'x86_64-pc-linux-musl'
broken on alpine 3.14 because sysconfig.get_config_var('HOST_GNU_TYPE') returns x86_64-alpine-linux-musl instead of x86_64-pc-linux-musl

Activity

  1. adiroiban commented on Jan 6, 2023

    @adiroiban

    Note that sysconfig.get_config_var('HOST_GNU_TYPE') will not always help.

    at least not on Python 2.7 and not on void linux with musl.

    $ ldd --version
    musl libc (x86_64)
    Version 1.1.24
    Dynamic Program Loader
    Usage: ldd [options] [--] pathname
    
    $ ./bin/python
    Python 2.7.18 (d2b7dcc, Nov  7 2022, 10:28:51)
    [GCC 9.3.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sysconfig
    >>> sysconfig.get_config_var('HOST_GNU_TYPE')
    'x86_64-pc-linux-gnu'
    >>>
    

    I am detecting musl via

    >>> import platform
    >>> platform.libc_ver()
    ('', '')
    
  2. adiroiban commented on Jan 6, 2023

    @adiroiban

    Maybe something like this will do.

    it works for me :)

    import platform
    
    def is_x86_64_musl():
        is_x86_64 = platform.processor() == 'x86_64'
        # I don't know how to detect `musl` in another way.
        unknown_libc = platform.libc_ver()[0] == ''
        return is_x86_64 and unknown_libc
  3. skycaptain commented on Dec 9, 2024

    @skycaptain

    This fix would be essential for making pre-commit work with NodeJS hooks in a minimal Alpine container, where no toolchain is available to compile node from source. @adiroiban, your solution looks good. Would you mind if I turned it into a PR?

  4. added 2 commits that reference this issue on Sep 22, 2026
    aadf307
    fd19956
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