This is a fork from https://github.com/sgerrand/alpine-pkg-glibc
This is the GNU C Library as a Alpine Linux package to run binaries linked against glibc
. This package utilizes a custom built glibc binary based on the vanilla glibc source.
This project supports multi-architecture, such as x86_64, aarch64, arm32v7, etc, I am using in my projects with x86_64 and aarch64, not yet verified on other CPU arch, but should be alright.
docker build alpine-glibc-builder .
# OR simply
docker-compose build
The Dockerfile is build with multi stage, the first stage is based on ubuntu to build glibc artifacts from source. The second stage is based on alpine for apk packaging. There will be 4 apk packages generated.
- glibc-${VERSION}-r0.apk
- glibc-bin-${VERSION}-r0.apk
- glibc-i18n-${VERSION}-r0.apk
- glibc-dev-${VERSION}-r0.apk
# Create a container, the container will exit by default
docker run --name container_name leadstec/glibc-builder:${VERSION}
# Or simply
docker-compose up
# Use 'docker cp' to copy the whole artifacts folder from container
docker cp container_name:/home/builder/packages/builder/x86_64 .
# In case you build on aarch64 OS
docker cp container_name:/home/builder/packages/builder/aarch64 .
See the releases page for the latest download links. If you are using tools like localedef
you will need the glibc-bin
and glibc-i18n
packages in addition to the glibc
package.
The current installation method for these packages is to pull them in using wget
or curl
and install the local file with apk
:
apk --allow-untrusted add glibc-${VERSION}-r0.apk
You will need to generate your locale if you would like to use a specific one for your glibc application. You can do this by installing the glibc-i18n
package and generating a locale using the localedef
binary. An example for en_US.UTF-8 would be:
apk --allow-untrusted add glibc-bin-${VERSION}-r0.apk glibc-i18n-${VERSION}-r0.apk
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8