|
|
|
@ -74,6 +74,7 @@ function Compile(compilers) {
|
|
|
|
|
this.cacheHits = 0;
|
|
|
|
|
this.cacheMisses = 0;
|
|
|
|
|
this.compileQueue = new Queue(gccProps("maxConcurrentCompiles", 1), Infinity);
|
|
|
|
|
this.multiarch = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Compile.prototype.newTempDir = function () {
|
|
|
|
@ -123,12 +124,18 @@ Compile.prototype.getRemote = function (compiler) {
|
|
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Compile.prototype.runCompiler = function (compiler, options) {
|
|
|
|
|
Compile.prototype.runCompiler = function (compiler, options, needsMulti) {
|
|
|
|
|
var okToCache = true;
|
|
|
|
|
var env = {};
|
|
|
|
|
if (needsMulti && this.multiarch) {
|
|
|
|
|
env.LIBRARY_PATH = '/usr/lib/' + this.multiarch;
|
|
|
|
|
env.C_INCLUDE_PATH = '/usr/include/' + this.multiarch;
|
|
|
|
|
env.CPLUS_INCLUDE_PATH = '/usr/include/' + this.multiarch;
|
|
|
|
|
}
|
|
|
|
|
var child = child_process.spawn(
|
|
|
|
|
compiler,
|
|
|
|
|
options,
|
|
|
|
|
{detached: true}
|
|
|
|
|
{detached: true, env: env}
|
|
|
|
|
);
|
|
|
|
|
var stdout = "";
|
|
|
|
|
var stderr = "";
|
|
|
|
@ -180,9 +187,7 @@ Compile.prototype.getMultiarch = function () {
|
|
|
|
|
var multi = child_process.execSync("gcc -print-multiarch").toString().trim();
|
|
|
|
|
if (multi) {
|
|
|
|
|
console.log("Multiarch: " + multi);
|
|
|
|
|
process.env.LIBRARY_PATH = '/usr/lib/' + multi;
|
|
|
|
|
process.env.C_INCLUDE_PATH = '/usr/include/' + multi;
|
|
|
|
|
process.env.CPLUS_INCLUDE_PATH = '/usr/include/' + multi;
|
|
|
|
|
this.multiarch = multi;
|
|
|
|
|
} else {
|
|
|
|
|
console.log("No multiarch");
|
|
|
|
|
}
|
|
|
|
@ -265,7 +270,7 @@ Compile.prototype.compile = function (source, compiler, options, filters) {
|
|
|
|
|
compilerExe = compilerWrapper;
|
|
|
|
|
}
|
|
|
|
|
var maxSize = gccProps("max-asm-size", 8 * 1024 * 1024);
|
|
|
|
|
return self.runCompiler(compilerExe, options).then(function (result) {
|
|
|
|
|
return self.runCompiler(compilerExe, options, compilerInfo.needsMulti).then(function (result) {
|
|
|
|
|
result.dirPath = dirPath;
|
|
|
|
|
if (result.code !== 0) {
|
|
|
|
|
result.asm = "<Compilation failed>";
|
|
|
|
|