The following assumes you want a single user install. If you want a system wide install instead, run the attached script create-patchelf-pkg.sh
(after first installing a suitable build environment).
Note: create-patchelf-pkg.sh
also provides an uninstall script.
Install a basic build environment (if you don't already have one). How to install this varies from distro to distro. Your best bet to refer to your distro's wiki or ask in their forums. That said, here are a few example install commands for a few of the popular distros:
- Ubunt/Mint/Debian:
sudo install build-essential
- Fedora:
sudo dnf install @development-tools
- OpenSUSE:
sudo zypper install -t pattern devel_basis
First go the the PatchELF release page to find out the latest version number, then issue the following commands (adjusting the version number as needed).
wget https://github.com/NixOS/patchelf/archive/refs/tags/0.18.0.tar.gz
tar xf 0.18.0.tar.gz
cd patchelf-0.18.0
./bootstrap.sh
./configure --prefix="$HOME/.local"
make install
strip --strip-unneeded ~/.local/bin/patchelf
gzip -9 ~/.local/share/man/man1/patchelf.1
Update your $PATH
variable to include $HOME/.local/bin
(if it doesn't already).
If you later need to uninstall, issue the following:
rm -rv ~/.local/{share/doc/patchelf,share/man/man1/patchelf.1.gz,bin/patchelf}
Note: The above command assumes a bash shell.
If you didn't follow any of the above and just did a system-wide install via ./configure && sudo make install
—that you could now like to remove—you can use the following generic self-compiled package removal guide to uninstall PatchELF.
For folks having issues with the uninstall, here's one with the absolute path (so you don't have to run it from ~):
rm -rv ~/.local/{share/doc/patchelf,share/man/man1/patchelf.1.gz,bin/patchelf}
Also there's a new version of patchelf out (0.9) - here are the updated lines for single-user install: