Skip to content

Instantly share code, notes, and snippets.

@h4x5p4c3
Last active July 28, 2022 06:44
Show Gist options
  • Save h4x5p4c3/82791fb6abb32253c4343669d2e5f38b to your computer and use it in GitHub Desktop.
Save h4x5p4c3/82791fb6abb32253c4343669d2e5f38b to your computer and use it in GitHub Desktop.
script to build glibc with debug symbols on arch linux
#!/bin/bash
# Check if script runs as root
if [ "$(id -u)" = 0 ]; then
echo "##################################################################"
echo "This script MUST NOT be run as root user since it makes changes"
echo "to the \$HOME directory of the \$USER executing this script."
echo "The \$HOME directory of the root user is, of course, '/root'."
echo "We don't want to mess around in there. So run this script as a"
echo "normal user. You will be asked for a sudo password when necessary."
echo "##################################################################"
exit 1
fi
# Dependencies
sudo pacman -S --needed --noconfirm lib32-gcc-libs devtools base base-devel
# install yay
cd $HOME
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
# Get pkg build from ABS
cd $HOME
yay -Syy
yay -G glibc
cd ./glibc/repos/core-x86_64
sed -i 's/options=(!strip staticlibs)/options=(!strip debug staticlibs)/' PKGBUILD
# Use devtools makepkg config to compile glibc successfully
sudo mv /etc/makepkg.conf /etc/makepkg.conf.backup
sudo cp -r /usr/share/devtools/makepkg-x86_64.conf /etc/makepkg.conf
sudo sed -i 's/OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto)/OPTIONS=(!strip docs !libtool staticlibs emptydirs zipman purge debug lto)/' /etc/makepkg.conf
makepkg -si --nocheck --skipinteg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment