|
94 | 94 | run: sudo apt-get -yq install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
|
95 | 95 | - name: Install Linux arm64 compilers/libraries
|
96 | 96 | run: sudo apt-get -yq install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
|
| 97 | + - name: Add patches to minimize needed GLIBC version |
| 98 | + run: | |
| 99 | + CURRENT_DIR="$(pwd)" |
| 100 | + sudo apt-get -yq install python3 |
| 101 | + # download chromium reversion_glibc.py script from chromium source tree at pinned commit (incase they ever move or change it) |
| 102 | + wget https://raw.githubusercontent.com/chromium/chromium/01bc42d648c45439e1beef8fd25fde3aef9079bc/build/linux/sysroot_scripts/reversion_glibc.py -O /tmp/reversion_glibc.py |
| 103 | + # set targeted minimum GLIBC to 2.17 |
| 104 | + sed -i 's/26]/17]/g' /tmp/reversion_glibc.py |
| 105 | + chmod +x /tmp/reversion_glibc.py |
| 106 | +
|
| 107 | + # download the host libc6 package from apt and patch the binaries in it |
| 108 | + # replacing the host libc6 at runtime causes crashs and hangs but apt is able to do it without issue |
| 109 | + sudo apt-get install --download-only --reinstall -y libc6 |
| 110 | + sudo rm -rf /tmp/libc6 |
| 111 | + sudo mkdir /tmp/libc6 |
| 112 | + sudo cp /var/cache/apt/archives/libc6_2.31-*_amd64.deb /tmp/libc6 |
| 113 | + cd /tmp/libc6 |
| 114 | + deb_name="$(ls)" |
| 115 | + sudo ar x "$deb_name" |
| 116 | + sudo tar xf data.tar.xz |
| 117 | + sudo mkdir DEBIAN |
| 118 | + sudo tar xf control.tar.xz -C DEBIAN |
| 119 | + sudo rm -f control.tar.xz \ |
| 120 | + data.tar.xz \ |
| 121 | + debian-binary \ |
| 122 | + DEBIAN/md5sums \ |
| 123 | + DEBIAN/archives \ |
| 124 | + DEBIAN/conffiles \ |
| 125 | + "$deb_name" |
| 126 | + |
| 127 | + # patch libc6 in host download deb and cross compilers using the reversion_glibc.py script |
| 128 | + files=(/tmp/libc6/lib/x86_64-linux-gnu/libc.so.6 /tmp/libc6/lib/x86_64-linux-gnu/libm.so.6 |
| 129 | + /usr/aarch64-linux-gnu/lib/libc.so.6 /usr/aarch64-linux-gnu/lib/libm.so.6 \ |
| 130 | + /usr/arm-linux-gnueabihf/lib/libc.so.6 /usr/arm-linux-gnueabihf/lib/libm.so.6 \ |
| 131 | + /libx32/libc.so.6 /libx32/libm.so.6 \ |
| 132 | + /lib32/libc.so.6 /lib32/libm.so.6) |
| 133 | + for file in "${files[@]}"; do |
| 134 | + sudo python3 /tmp/reversion_glibc.py "$file" |
| 135 | + done |
| 136 | + |
| 137 | + # install patched libc6 deb |
| 138 | + sudo dpkg-deb -b . "$deb_name" |
| 139 | + sudo apt install --reinstall --allow-downgrades -y ./"$deb_name" |
| 140 | + cd "$CURRENT_DIR" |
| 141 | +
|
| 142 | + # __GLIBC_MINOR__ is used as a feature test macro. Replace it with the |
| 143 | + # earliest supported version of glibc 2.17 |
| 144 | + sudo sed -i 's|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' "/usr/include/features.h" |
| 145 | + sudo sed -i 's|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' "/usr/aarch64-linux-gnu/include/features.h" |
| 146 | + sudo sed -i 's|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' "/usr/arm-linux-gnueabihf/include/features.h" |
| 147 | + # fcntl64() was introduced in glibc 2.28. Make sure to use fcntl() instead. |
| 148 | + sudo sed -i '{N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' "/usr/include/fcntl.h" |
| 149 | + sudo sed -i '{N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' "/usr/aarch64-linux-gnu/include/fcntl.h" |
| 150 | + sudo sed -i '{N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' "/usr/arm-linux-gnueabihf/include/fcntl.h" |
97 | 151 | - name: Download macOS natives
|
98 | 152 | uses: actions/download-artifact@v3
|
99 | 153 | with:
|
|
0 commit comments