Skip to content

Add support for building libclang targeting older versions of glibc #4

Open
@PathogenDavid

Description

@PathogenDavid

Currently we built our native components using Ubuntu 18.04 (the oldest in-support version of Ubuntu supported by GitHub Actions) so that our binary can be used on Linux systems utilizing glibc 2.27 or later.

However, glibc 2.27 is not actually all that old. For instance, CentOS 7 (in support until June 2024) still uses glibc 2.17 and Debian 9 (in support until June 2022) uses 2.24.

Rokas offered some solutions here: MochiLibraries/Biohazrd#155 (reply in thread)

The "easy" solution is probably to create a self-hosted GitHub Actions runner on CentOS or whatever the least common denominator is. Not a fan of this since it means more ongoing maintenance.

We could possibly set up a chroot or CentOS/whatever that is downloaded by CI.

The harder but better solution is to use this project to force libclang to be built against an older version of glibc: https://github.com/wheybags/glibc_version_header
It's not totally clear how involved this will be. It's pretty easy for a C app, but C++ poses some unique issues noted in the readme.

Another possibility not mentioned by Rokas is using a Docker image of CentOS/whatever for building. The x64 CentOS 7 image is "only" 72.57 MB. That's a little fat, but considering it's actually smaller than libclang its self is (which is kinda depressing) maybe that's not so bad.

One final possibility is using musl libc instead of glibc. This is what sccache does, not sure if it's practical for libclang or not.

Looking at the official binary distributions of LLVM: It seems that for x64 they're distributing separate binaries for each Ubuntu LTS as well as SLES. For ARM64 it appears they're just building a single binary distribution targeting an unspecified version of glibc. The separate binaries for x64 might just be a historical artifact, might be worth looking into how they're building that ARM64 distribution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions