diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base-compiler.js | 30 | ||||
-rw-r--r-- | lib/compiler-finder.js | 6 | ||||
-rw-r--r-- | lib/compilers/clean.js | 2 | ||||
-rw-r--r-- | lib/compilers/win32.js | 2 |
4 files changed, 30 insertions, 10 deletions
diff --git a/lib/base-compiler.js b/lib/base-compiler.js index f9e109237..aaa37cf3a 100644 --- a/lib/base-compiler.js +++ b/lib/base-compiler.js @@ -365,18 +365,31 @@ export class BaseCompiler { return _.union( [libPathFlag + '.'], [pathFlag + '.'], - this.compiler.ldPath.map(path => pathFlag + path), + this.compiler.libPath.map(path => pathFlag + path), toolchainLibraryPaths.map(path => pathFlag + path), this.getSharedLibraryPaths(libraries).map(path => pathFlag + path), this.getSharedLibraryPaths(libraries).map(path => libPathFlag + path)); } - getSharedLibraryPathsAsLdLibraryPaths(/*libraries*/) { - if (this.alwaysResetLdPath) { - return []; - } else { - return process.env.LD_LIBRARY_PATH ? process.env.LD_LIBRARY_PATH : []; + getSharedLibraryPathsAsLdLibraryPaths(libraries) { + let paths = []; + if (!this.alwaysResetLdPath) { + paths = process.env.LD_LIBRARY_PATH ? process.env.LD_LIBRARY_PATH : []; } + return _.union(paths, + this.compiler.ldPath, + this.getSharedLibraryPaths(libraries)); + } + + getSharedLibraryPathsAsLdLibraryPathsForExecution(libraries) { + let paths = []; + if (!this.alwaysResetLdPath) { + paths = process.env.LD_LIBRARY_PATH ? process.env.LD_LIBRARY_PATH : []; + } + return _.union(paths, + this.compiler.ldPath, + this.compiler.libPath, + this.getSharedLibraryPaths(libraries)); } getIncludeArguments(libraries) { @@ -734,7 +747,7 @@ export class BaseCompiler { }; } - executeParameters.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths(key.libraries); + executeParameters.ldPath = this.getSharedLibraryPathsAsLdLibraryPathsForExecution(key.libraries); const result = await this.runExecutable(buildResult.executableFilename, executeParameters); result.didExecute = true; result.buildResult = buildResult; @@ -792,7 +805,7 @@ export class BaseCompiler { ); const execOptions = this.getDefaultExecOptions(); - execOptions.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths(key.libraries); + execOptions.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths([]); const makeAst = backendOptions.produceAst && this.compiler.supportsAstView; const makeIr = backendOptions.produceIr && this.compiler.supportsIrView; @@ -1224,6 +1237,7 @@ Please select another pass or change filters.`; const execOptions = this.getDefaultExecOptions(); const versionFlag = this.compiler.versionFlag || '--version'; execOptions.timeoutMs = 0; // No timeout for --version. A sort of workaround for slow EFS/NFS on the prod site + execOptions.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths([]); try { return this.execCompilerCached(this.compiler.exe, [versionFlag], execOptions, true); diff --git a/lib/compiler-finder.js b/lib/compiler-finder.js index f4366dd4b..f005c989c 100644 --- a/lib/compiler-finder.js +++ b/lib/compiler-finder.js @@ -301,6 +301,12 @@ export class CompilerFinder { return []; } + if (process.platform === 'win32') { + compilerInfo.libPath = compilerInfo.libPath.split(';').filter((p) => p !== ''); + } else { + compilerInfo.libPath = compilerInfo.libPath.split(':').filter((p) => p !== ''); + } + logger.debug('Found compiler', compilerInfo); return compilerInfo; } diff --git a/lib/compilers/clean.js b/lib/compilers/clean.js index dd998b655..88a7d0a2d 100644 --- a/lib/compilers/clean.js +++ b/lib/compilers/clean.js @@ -82,7 +82,7 @@ export class CleanCompiler extends BaseCompiler { execOptions = this.getDefaultExecOptions(); execOptions.customCwd = tmpDir; execOptions.env.CLEANLIB = path.join(compilerPath, '../exe'); - execOptions.env.CLEANPATH = this.compiler.libPath; + execOptions.env.CLEANPATH = this.compiler.libPath.join(':'); options.pop(); options.push(moduleName); diff --git a/lib/compilers/win32.js b/lib/compilers/win32.js index 220fcf952..3c06bbbe0 100644 --- a/lib/compilers/win32.js +++ b/lib/compilers/win32.js @@ -163,7 +163,7 @@ export class Win32Compiler extends BaseCompiler { options.env['INCLUDE'] = this.compiler.includePath; } if (this.compiler.libPath) { - options.env['LIB'] = this.compiler.libPath; + options.env['LIB'] = this.compiler.libPath.join(';'); } for (const [env, to] of this.compiler.envVars) { options.env[env] = to; |