feat: test and lower glibc version requirement (#2143)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run

Lock Linux to minimum supported version (Ubuntu 18.04 / RHEL 8, glibc
2.28).
This commit is contained in:
Myriad-Dreamin 2025-09-30 16:48:41 +08:00 committed by GitHub
parent d617b145e2
commit c8e723fac7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 0 deletions

43
scripts/test-glibc.mjs Normal file
View file

@ -0,0 +1,43 @@
import { exec as execSync } from "child_process";
import util from "node:util";
const exec = util.promisify(execSync);
const binaryPath = process.argv[2];
// get glibc symbols by l
const symbols = await exec(`objdump -T ${binaryPath}`);
const GLIBC_VERSION_REGEX = /\(GLIBC_([\d.]+)\)/;
const versionSet = new Set(
symbols.stdout
.split("\n")
.filter((line) => line.match(GLIBC_VERSION_REGEX))
.map((line) => line.match(GLIBC_VERSION_REGEX)[1]),
);
class GLIBCVersion {
constructor(version) {
this.semver = version.split(".").map((it) => Number.parseInt(it));
}
}
const versions = Array.from(versionSet)
.map((version) => new GLIBCVersion(version))
.filter((it) => it.semver.length == 2);
let maxMinor = 0;
for (const version of versions) {
if (version.semver[0] !== 2) {
throw new Error("GLIBC version is not 2");
}
if (version.semver[1] > maxMinor) {
maxMinor = version.semver[1];
}
}
console.log(maxMinor);
if (maxMinor > 28) {
throw new Error(`GLIBC version is greater than 2.28, got GLIBC_2.${maxMinor}`);
}