CI: Fix "invalid ELF header" error for libc.so in OS.File.unixSymLink()
This commit is contained in:
parent
38e4fea455
commit
26bfe3dbdc
1 changed files with 26 additions and 14 deletions
|
@ -225,20 +225,32 @@ export let OS = {
|
|||
);
|
||||
|
||||
try {
|
||||
const libc = ctypes.open(
|
||||
Services.appinfo.OS === "Darwin" ? "libSystem.B.dylib" : "libc.so"
|
||||
);
|
||||
|
||||
const symlink = libc.declare(
|
||||
"symlink",
|
||||
ctypes.default_abi,
|
||||
ctypes.int, // return value
|
||||
ctypes.char.ptr, // target
|
||||
ctypes.char.ptr //linkpath
|
||||
);
|
||||
|
||||
if (symlink(pathTarget, pathCreate)) {
|
||||
throw new Error("Failed to create symlink at " + pathCreate);
|
||||
if (Services.appinfo.OS === "Darwin") {
|
||||
const libc = ctypes.open(
|
||||
Services.appinfo.OS === "Darwin" ? "libSystem.B.dylib" : "libc.so"
|
||||
);
|
||||
|
||||
const symlink = libc.declare(
|
||||
"symlink",
|
||||
ctypes.default_abi,
|
||||
ctypes.int, // return value
|
||||
ctypes.char.ptr, // target
|
||||
ctypes.char.ptr //linkpath
|
||||
);
|
||||
|
||||
if (symlink(pathTarget, 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) {
|
||||
|
|
Loading…
Reference in a new issue