Skip to content

Commit 4c2c9d3

Browse files
committed
fix: install libtinfo-dev for llvm on linux
1 parent 8bb24cd commit 4c2c9d3

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/llvm/llvm.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,27 @@ async function getLLVMPackageInfo(version: string, platform: NodeJS.Platform, _a
244244
}
245245

246246
export async function setupLLVM(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
247-
const installationInfo = await setupBin("llvm", version, getLLVMPackageInfo, setupDir, arch)
247+
const installationInfo = await _setupLLVM(version, setupDir, arch)
248248
await activateLLVM(installationInfo.installDir ?? setupDir, version)
249249
return installationInfo
250250
}
251251

252-
export async function activateLLVM(directory: string, versionGiven: string) {
253-
if (process.platform === "linux") {
254-
// install llvm build dependencies
255-
await setupAptPack("build-essential") // TODO(question) llvm needs ld. But does it need all the build-essential?
252+
let didInit = false
253+
async function _setupLLVM(version: string, setupDir: string, arch: string) {
254+
const installationInfo = await setupBin("llvm", version, getLLVMPackageInfo, setupDir, arch)
255+
if (!didInit) {
256+
if (process.platform === "linux") {
257+
// install llvm build dependencies
258+
await setupAptPack("build-essential") // TODO(question) llvm needs ld. But does it need all the build-essential?
259+
await setupAptPack("libtinfo-dev")
260+
}
261+
// eslint-disable-next-line require-atomic-updates
262+
didInit = true
256263
}
264+
return installationInfo
265+
}
257266

267+
export async function activateLLVM(directory: string, versionGiven: string) {
258268
const version = semverCoerceIfInvalid(versionGiven)
259269

260270
const lib = path.join(directory, "lib")
@@ -295,7 +305,7 @@ export function setupClangTools(version: string, setupDir: string, arch: string)
295305
if (isGitHubCI()) {
296306
addLLVMLoggingMatcher()
297307
}
298-
return setupBin("llvm", version, getLLVMPackageInfo, setupDir, arch)
308+
return _setupLLVM(version, setupDir, arch)
299309
}
300310

301311
function addLLVMLoggingMatcher() {

0 commit comments

Comments
 (0)