add glibc rec

This commit is contained in:
larssand
2026-09-02 19:53:16 +02:00
parent 483a9dbd5a
commit 9aeb638211
8 changed files with 55 additions and 5 deletions

View File

@@ -15,6 +15,21 @@ function fail(message, error) {
process.exit(1);
}
function warn(message) {
console.warn(`[verify] WARNING: ${message}`);
}
function compareVersions(left, right) {
const leftParts = String(left || "").split(".").map((part) => Number(part) || 0);
const rightParts = String(right || "").split(".").map((part) => Number(part) || 0);
const length = Math.max(leftParts.length, rightParts.length);
for (let index = 0; index < length; index += 1) {
const difference = (leftParts[index] || 0) - (rightParts[index] || 0);
if (difference !== 0) return difference;
}
return 0;
}
try {
require("express");
} catch (error) {
@@ -47,5 +62,28 @@ if (process.platform === "win32") {
console.log(`[verify] AMMC Windows runtime: ${ammcDir}`);
}
if (process.platform === "linux" && process.arch === "x64") {
const ammcPath = path.join(root, "AMMC", "linux_x86-64", "ammc-amb");
const requiredGlibc = "2.39";
if (!fs.existsSync(ammcPath)) {
warn(`Bundled Linux AMMC binary is missing: ${ammcPath}`);
} else {
try {
fs.accessSync(ammcPath, fs.constants.X_OK);
} catch {
warn(`Bundled Linux AMMC is not executable. Run: chmod +x AMMC/linux_x86-64/ammc-amb`);
}
const glibcVersion = process.report?.getReport?.().header?.glibcVersionRuntime || "";
if (!glibcVersion) {
warn(`Could not detect the host GLIBC version. The bundled Linux AMMC requires GLIBC ${requiredGlibc} or newer.`);
} else if (compareVersions(glibcVersion, requiredGlibc) < 0) {
warn(`Host GLIBC ${glibcVersion} is too old for the bundled Linux AMMC (requires >= ${requiredGlibc}). RC RaceCore can still run, but use a compatible AMMC build or a newer Linux distribution. Do not replace the system GLIBC manually.`);
} else {
console.log(`[verify] AMMC Linux runtime: ${ammcPath} (GLIBC ${glibcVersion}, requires >= ${requiredGlibc})`);
}
}
}
console.log(`[verify] Express and SQLite: OK (${process.platform}/${process.arch}, Node ${process.version})`);
console.log(`[verify] Installation is ready. Start with: ${process.platform === "win32" ? "npm.cmd start" : "npm start"}`);