Commit 57b03984 authored by Ariadne Conill's avatar Ariadne Conill
Browse files


parent 918682c0
# gcompat
The gcompat project provides a glibc-compatible runtime environment for distributions that use musl libc.
It provides a compatibility library as well as a loader which injects the compatibility library. The loader
is installed where the glibc ELF interpreter (`/lib/`) would normally be, allowing for execution
of glibc programs to work in the same way as native musl programs.
## building gcompat
In order to build correctly, the gcompat build system requires a few details about the host environment, both
from the musl end, as well as the glibc end. These are:
| Variable | Description |
| `LINKER_PATH` | The location of the musl ELF interpreter. |
| `LOADER_NAME` | The name of the glibc ELF interpreter that would be appropriate for your architecture. |
| `LIBGCOMPAT_PATH` | *optional* The location to install the library to. Usually `/lib/`. |
| `LOADER_PATH` | *optional* The location to install the loader to. Usually `/lib/${LOADER_NAME}`. |
For example on x86_64 musl with x86_64 glibc compatibility, you would want to do:
$ make LINKER_PATH=/lib/
$ make LINKER_PATH=/lib/ install
The `DESTDIR` environment variable is available for the convenience of packagers.
## running programs under gcompat
Assuming everything is in the right place, the programs should just work. If they are not working, check the program's
ELF interpreter entry, using scanelf(8) like so:
$ scanelf -i ~/glibcfile
ET_EXEC /lib64/ /home/kaniini/glibcfile
If the interpreter path is different than expected, use PatchELF or install a symlink to the interpreter.
## making musl programs accept glibc binaries for dlopen(3)
Just add to the DT_NEEDED entries in the ELF that you want to have the gcompat symbols available in.
Use a tool such as PatchELF for this.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment