fix: display the reason when the linker can't be called and fix the root cause

This commit is contained in:
rudy
2022-09-07 09:32:36 +02:00
committed by rudy-6-4
parent deef4486ba
commit e5d9cb1af3
2 changed files with 8 additions and 2 deletions

View File

@@ -263,6 +263,7 @@ KeySetCache::loadOrGenerateSave(ClientParameters &params, uint64_t seed_msb,
// The lock is released when the function returns.
// => any intermediate state in the function is not visible to others.
auto unlockAtReturn = llvm::make_scope_exit([&]() {
llvm::sys::fs::closeFile(FD_lock);
llvm::sys::fs::unlockFile(FD_lock);
llvm::sys::fs::remove(lockPath);
});

View File

@@ -3,6 +3,8 @@
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// for license information.
#include <errno.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/MC/TargetRegistry.h>
#include <llvm/Support/Host.h>
@@ -85,9 +87,12 @@ string linkerCmd(vector<string> objectsPath, string libraryPath, string linker,
}
llvm::Error callCmd(string cmd) {
errno = 0;
FILE *fp = popen(cmd.c_str(), "r");
if (fp == NULL)
return StreamStringError("Cannot call the linker: " + cmd);
if (fp == NULL) {
return StreamStringError(strerror(errno))
<< "\nCannot call the linker: " << cmd;
}
string outputContent;
const int CHUNK_SIZE = 1024;