CI: Fix "invalid ELF header" error for libc.so in OS.File.unixSymLink()

This commit is contained in:
Dan Stillman 2024-03-30 07:00:52 -04:00
parent 38e4fea455
commit 26bfe3dbdc

View file

@ -225,6 +225,7 @@ export let OS = {
); );
try { try {
if (Services.appinfo.OS === "Darwin") {
const libc = ctypes.open( const libc = ctypes.open(
Services.appinfo.OS === "Darwin" ? "libSystem.B.dylib" : "libc.so" Services.appinfo.OS === "Darwin" ? "libSystem.B.dylib" : "libc.so"
); );
@ -241,6 +242,17 @@ export let OS = {
throw new Error("Failed to create symlink at " + pathCreate); throw new Error("Failed to create symlink at " + pathCreate);
} }
} }
// The above is failing with "invalid ELF header" for libc.so on GitHub Actions, so
// just use ln -s on non-macOS systems
else {
let ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
ln.initWithPath("/bin/ln");
let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
process.init(ln);
let args = ["-s", pathTarget, pathCreate];
process.run(true, args, args.length);
}
}
catch (e) { catch (e) {
dump(e.message + "\n\n"); dump(e.message + "\n\n");
throw new Error("Failed to create symlink at " + pathCreate); throw new Error("Failed to create symlink at " + pathCreate);