Co-existing GLIBC binaries with Void-Linux MUSL edition

I am running void-linux at home with musl as the standard C library.

While most things work well, there is a number of programs that do not and must be using glibc counterparts.

To enable this I followed this guide here: Live switching Void Linux from glibc to musl.

To set-up:

mkdir -p /glibc
sudo env XBPS_ARCH=x86_64 xbps-install --repository= -r /glibc -S base-voidstrap
  • sudo : yes, we need root
  • env : Needed because we are using sudo.
  • XBPS_ARCH=x86_64 : architecture to use. Since we are using musl, we point to the glibc version. It should be possible to create a 32 bit root here.
  • --repository= : the repository to use. Feel free to replace to something closer.
  • -r /glibc : directory tree where the glibc executables will live
  • base-voidstrap : unlike base-system, this meta-package is normally used for containers.

To keep this tree up to date:

sudo env XBPS_ARCH=x86_64 xbps-install --repository= -r /glibc -Su

To add software to the tree:

sudo env XBPS_ARCH=x86_64 xbps-install --repository= -r /glibc -S pkg

Once this is set-up you need a small program to kick off the glibc executables. I copied this one:

{! void-glibc-in-musl/glibc.c !}


To compile and install:

gcc -s -o glibc glibc.c
sudo cp glibc /usr/bin
sudo chown root:root /usr/bin/glibc
sudo chmod +sx /usr/bin/glibc

Then you can just run:

glibc cmd args

The following software I have found doesn't work well using musl:

  • Calibre
  • building buildroot (Because of compilation of fakeroot)