Skip to content

Commit c3d79f4

Browse files
committed
fix(amazonq): fix chat on old glibc platforms
1 parent dbeec62 commit c3d79f4

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLspService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ private class AmazonQServerInstance(private val project: Project, private val cs
372372
}
373373

374374
val node = if (SystemInfo.isWindows) "node.exe" else "node"
375-
val cmd = GeneralCommandLine(
376-
artifact.resolve(node).toString(),
375+
val cmd = NodeExePatcher.patch(artifact.resolve(node))
376+
.withParameters(
377377
LspSettings.getInstance().getArtifactPath() ?: artifact.resolve("aws-lsp-codewhisperer.js").toString(),
378378
"--stdio",
379379
"--set-credentials-encryption-key",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package software.aws.toolkits.jetbrains.services.amazonq.lsp
5+
6+
import com.intellij.execution.configurations.GeneralCommandLine
7+
import software.aws.toolkits.core.utils.getLogger
8+
import software.aws.toolkits.core.utils.info
9+
import java.nio.file.Path
10+
11+
/**
12+
* Hacky nonsense to support old glibc platforms like AL2
13+
* @see https://github.com/microsoft/vscode/issues/231623
14+
* @see https://github.com/aws/aws-toolkit-vscode/commit/6081f890bdbb91fcd8b60c4cc0abb65b15d4a38d
15+
*/
16+
object NodeExePatcher {
17+
private const val GLIBC_LINKER_VAR = "VSCODE_SERVER_CUSTOM_GLIBC_LINKER"
18+
private const val GLIBC_PATH_VAR = "VSCODE_SERVER_CUSTOM_GLIBC_PATH"
19+
20+
fun patch(node: Path): GeneralCommandLine {
21+
val linker = System.getenv(GLIBC_LINKER_VAR)
22+
val glibc = System.getenv(GLIBC_PATH_VAR)
23+
val nodePath = node.toAbsolutePath().toString()
24+
25+
if (!linker.isNullOrEmpty() && !glibc.isNullOrEmpty()) {
26+
return GeneralCommandLine(linker)
27+
.withParameters("--library-path", glibc, nodePath)
28+
.also {
29+
getLogger<NodeExePatcher>().info { "Using glibc patch: $it" }
30+
}
31+
} else {
32+
return GeneralCommandLine(nodePath)
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)