Advertisement
plirof2

Download -compile different glibc

May 16th, 2024
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.12 KB | None | 0 0
  1. I have debian bulleye. Can you write me a bash script that will download and compile different glibc versions and put them on different folders? I want to be able to runn programs made for different versions using patchelf --set-interpreter . I don't want to change anything on my system. I just want to have different versions of glibc in different folders. Please, selecte the most important versions that will cover most of old and new programs.
  2.  
  3. ---------
  4. Sure! Here's a bash script that will download and compile glibc versions 2.13, 2.17, 2.23, 2.27, 2.31, and 2.33, and place them in different folders:
  5. ```bash
  6. #!/bin/bash
  7.  
  8. # Create directories for each glibc version
  9. mkdir glibc-2.13 glibc-2.17 glibc-2.23 glibc-2.27 glibc-2.31 glibc-2.33
  10.  
  11. # Download and extract glibc versions
  12. wget https://ftp.gnu.org/gnu/glibc/glibc-2.13.tar.gz
  13. tar -xzvf glibc-2.13.tar.gz -C glibc-2.13 --strip-components=1
  14.  
  15. wget https://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz
  16. tar -xzvf glibc-2.17.tar.gz -C glibc-2.17 --strip-components=1
  17.  
  18. wget https://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
  19. tar -xzvf glibc-2.23.tar.gz -C glibc-2.23 --strip-components=1
  20.  
  21. wget https://ftp.gnu.org/gnu/glibc/glibc-2.27.tar.gz
  22. tar -xzvf glibc-2.27.tar.gz -C glibc-2.27 --strip-components=1
  23.  
  24. wget https://ftp.gnu.org/gnu/glibc/glibc-2.31.tar.gz
  25. tar -xzvf glibc-2.31.tar.gz -C glibc-2.31 --strip-components=1
  26.  
  27. wget https://ftp.gnu.org/gnu/glibc/glibc-2.33.tar.gz
  28. tar -xzvf glibc-2.33.tar.gz -C glibc-2.33 --strip-components=1
  29.  
  30. # Compile each glibc version
  31. for dir in glibc-2.13 glibc-2.17 glibc-2.23 glibc-2.27 glibc-2.31 glibc-2.33; do
  32.     (
  33.         cd $dir
  34.         mkdir build
  35.         cd build
  36.         ../configure --prefix=$PWD/install
  37.         make -j$(nproc)
  38.         make install
  39.     )
  40. done
  41.  
  42. ```bash
  43. This script will download the specified glibc versions, extract them, compile them, and install them in separate directories. You can then use patchelf to set the interpreter path when running programs with different glibc versions.
  44.  
  45. Remember to give execute permission to the script using chmod +x script.sh and run it using ./script.sh from the terminal
  46.  
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement