Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

[wf-pacman] Add hook to relocate binaries and libraries with patchelf #34

Description

@asiekierka

On Linux, we use patchelf to make toolchain binaries and libraries use the toolchain-provided build of musl libc, like so:

wf_runtime_patchelf() {
        if [ "$WF_USE_MUSL" == "true" ]; then
                patchelf --set-rpath "$WF_PATH/lib" "$1"
                # Setting an interpreter is supported only on executables.
                # For libraries, ignore the failure.
                patchelf --set-interpreter "$WF_PATH/lib/ld-musl-$CARCH.so.1" "$1" || true
        fi
}

As a limitation, this hardcodes /opt/wonderful as the location for ld-musl.so.1. Fixing this requires doing a few things:

  • packaging patchelf as wf-patchelf on Linux (statically built!),
  • writing a Pacman hook that iterates over $WONDERFUL_TOOLCHAIN on installs/updates and patches all binaries/host libraries found.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions