Skip to content

Instantly share code, notes, and snippets.

@Yawning
Created February 22, 2024 09:08
Show Gist options
  • Save Yawning/3090758809f59afd9d38d86afa90c9fa to your computer and use it in GitHub Desktop.
Save Yawning/3090758809f59afd9d38d86afa90c9fa to your computer and use it in GitHub Desktop.
Make odin Linux release builds usable on normal systems.
#!/bin/sh
#
# The Odin binary package is built on Ubuntu, which inherits Debian's
# libedit stupdity. This makes the binary builds unusable, but it
# is easy to fix with patchelf to change the dependency to what normal
# systems ship.
#
# See: https://salsa.debian.org/debian/libedit/-/blob/master/debian/patches/update-soname.diff
#
if [ -e /usr/lib/libedit.so.2 ]; then
cat << EOF
It appears that you are running Debian or a derivative such as Ubuntu.
There should be no fixes to shared libraries required, as Ubuntu is used
to build the Odin release packages.
EOF
exit
fi
if ! [ -x "$(command -v patchelf)" ]; then
cat << EOF
It appears that patchelf is not installed on your system.
Arch (btw): pacman -S patchelf
Fedora: dnf install patchelf
Source: https://github.com/NixOS/patchelf
EOF
exit
fi
# Might as well make sure these are executable while we are here.
chmod +x libLLVM-14.so.1
chmod +x odin
# Use patchelf to replace the dependency that Debian derivatives
# gratuitiously rename, with what the original package actually ships.
patchelf --replace-needed libedit.so.2 libedit.so.0 libLLVM-14.so.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment