Last active
July 27, 2022 07:50
-
-
Save circleous/ef2700e2a263c281934385a0a72ffafe to your computer and use it in GitHub Desktop.
glibc build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/ray-cp/pwn_debug/blob/master/build.sh | |
#!/bin/sh | |
# echo "install some deps" | |
# sudo apt-get install gawk -y | |
# sudo apt-get install bison -y | |
# sudo apt-get install gcc-multilib -y | |
# sudo apt-get install g++-multilib -y | |
# get the source of glibc | |
Get_Glibc_Source(){ | |
sudo mkdir -p /opt/glibc/source | |
pushd /opt/glibc/source | |
if [ ! -f "/opt/glibc/source/glibc-$1.tar.gz" ]; then | |
sudo wget http://ftp.jaist.ac.jp/pub/GNU/glibc/glibc-$1.tar.gz | |
else | |
echo "[*] /opt/glibc/source/glibc-"$1" already exists..." | |
fi | |
sudo tar xf glibc-$1.tar.gz | |
popd | |
} | |
Install_Glibc_x64(){ | |
if [ -f "/opt/glibc/x64/"$1"/lib/libc-"$1".so" ];then | |
echo "x64 glibc "$1" already installed!" | |
return | |
fi | |
sudo mkdir -p /opt/glibc/x64/$1 | |
pushd /opt/glibc/source/glibc-$1 | |
sudo mkdir build | |
cd build | |
sudo ../configure --prefix=/opt/glibc/x64/$1/ --disable-werror --enable-debug=yes | |
sudo make | |
sudo make install | |
sudo rm -rf /opt/glibc/source/glibc-$1/build | |
popd | |
} | |
Install_Glibc_x86(){ | |
if [ -f "/opt/glibc/x86/"$1"/lib/libc-"$1".so" ];then | |
echo "x86 glibc "$1" already installed!" | |
return | |
fi | |
sudo mkdir -p /opt/glibc/x86/$1 | |
pushd /opt/glibc/source/glibc-$1 | |
sudo mkdir build | |
cd build | |
sudo ../configure --prefix=/opt/glibc/x86/$1/ --disable-werror --enable-debug=yes --host=i686-linux-gnu --build=i686-linux-gnu CC="gcc -m32" CXX="g++ -m32" | |
sudo make | |
sudo make install | |
sudo rm -rf /opt/glibc/source/glibc-$1/build | |
popd | |
} | |
Delete_Glibc_Tar() { | |
sudo rm glibc-$1.tar.gz | |
} | |
GLIBC_VERSION=$1 | |
if [ -n "$GLIBC_VERSION" ]; then | |
Get_Glibc_Source $GLIBC_VERSION | |
Install_Glibc_x64 $GLIBC_VERSION | |
Install_Glibc_x86 $GLIBC_VERSION | |
# Delete_Glibc_Tar $GLIBC_VERSION | |
else | |
for GLIBC_VERSION in '2.19' '2.23' '2.24' '2.25' '2.26' '2.27' '2.28' '2.29' | |
do | |
Get_Glibc_Source $GLIBC_VERSION | |
Install_Glibc_x64 $GLIBC_VERSION | |
Install_Glibc_x86 $GLIBC_VERSION | |
# Delete_Glibc_Tar $GLIBC_VERSION | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment