-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copilot-language-server: fix dynamically linked error in copilot-language-server derivation #391748
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR!
I am trying to replicate this issue on my machine, but the binary behaves normally, both from nixpkgs and building it myself... |
776825f
to
7b3433a
Compare
7b3433a
to
ab84243
Compare
4841009
to
80caa40
Compare
7642304
to
1250a76
Compare
6c90dee
to
779c961
Compare
okiee |
Here's the diff to fix everything. Please make it in 2 commits as I updated the version too. diff --git a/pkgs/by-name/co/copilot-language-server/package.nix b/pkgs/by-name/co/copilot-language-server/package.nix
index da30bc7e2f..8ee4136f07 100644
--- a/pkgs/by-name/co/copilot-language-server/package.nix
+++ b/pkgs/by-name/co/copilot-language-server/package.nix
@@ -4,7 +4,6 @@
fetchzip,
autoPatchelfHook,
nix-update-script,
- versionCheckHook,
}:
let
@@ -28,25 +27,21 @@
stdenv.mkDerivation (finalAttrs: {
pname = "copilot-language-server";
- version = "1.280.0";
+ version = "1.290.0";
src = fetchzip {
url = "https://github.com/github/copilot-language-server-release/releases/download/${finalAttrs.version}/copilot-language-server-native-${finalAttrs.version}.zip";
- hash = "sha256-s47WaWH0ov/UazQCOFBUAO6ZYgCmCpQ1o79KjAVJFh4=";
+ hash = "sha256-ELOSeb3Z7AI8pjDhtUIRoaf+4UXjXKEu/OJ2CLQno6A=";
stripRoot = false;
};
- npmDepsHash = "sha256-PLX/mN7xu8gMh2BkkyTncP3+rJ3nBmX+pHxl0ONXbe4=";
-
nativeBuildInputs = [
autoPatchelfHook
- versionCheckHook
];
+
buildInputs = [ stdenv.cc.cc.lib ];
- doCheck = true;
- checkFlags = "--version";
- versionExe = "./${os}-${arch}/copilot-language-server";
+ dontStrip = true;
installPhase = ''
runHook preInstall
@@ -56,8 +51,6 @@
runHook postInstall
'';
- dontStrip = true;
-
passthru.updateScript = nix-update-script { };
meta = { |
sure!! |
f33a00a
to
1dd03e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please make sure this PR only has 2 commits:
- The first one for fixing the original issue
- The second one to update to 1.290.0
Make sure you know how to write proper commit log messages.
For commit messages visit the following two links: |
Resolved dynamically linked error by replacing stdenvNoCC with stdenv and adding autoPatchelfHook.
Updated copilot-language-server to 1.290.0
1dd03e7
to
b4915b8
Compare
does it look alright? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect now!
thank you :) |
I guess we won't merge this PR as long as the syntax error is present? |
Which syntax error are you talking about? |
This one: #391748 (comment) |
Oooh right ! So this PR doesn't fix anything then? |
It's not for me, but please test it yourself and correct me if I'm wrong. It seems like the autopatch script breaks the binary. Maybe it is something specific to node binaries. While I approve the state of the code, I will only improve the PR if it solves the problem. I am not even sure how, where, or when it happens; the environment when it happens isn't clear. |
It seems like using an FHS solves the issue (the issue author tested it himself). I can either create a PR myself or my config can be implemented here, I am fine with both approaches. I am not sure on how to treat the problem.. either have one package which is build using fhs or have two packages, one without and one with fhs. I implemented the solution using a flag, but it can be split into two files if needed: {
lib,
stdenv,
buildFHSEnv,
fetchzip,
nix-update-script,
withFHS ? true,
}:
let
arch =
{
aarch64-darwin = "arm64";
aarch64-linux = "arm64";
x86_64-darwin = "x64";
x86_64-linux = "x64";
}
."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
os =
{
aarch64-darwin = "darwin";
aarch64-linux = "linux";
x86_64-darwin = "darwin";
x86_64-linux = "linux";
}
."${stdenv.hostPlatform.system}" or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
copilot-language-server = stdenv.mkDerivation (finalAttrs: {
pname = "copilot-language-server";
version = "1.280.0";
# version = "1.286.0";
# version = "1.290.0";
src = fetchzip {
url = "https://github.com/github/copilot-language-server-release/releases/download/${finalAttrs.version}/copilot-language-server-native-${finalAttrs.version}.zip";
hash = "sha256-s47WaWH0ov/UazQCOFBUAO6ZYgCmCpQ1o79KjAVJFh4=";
# hash = "sha256-yYsfp3Hdph8zOTkycjjV8nnWe0bT1QYgVSzSHVJ6HzM=";
# hash = "sha256-ELOSeb3Z7AI8pjDhtUIRoaf+4UXjXKEu/OJ2CLQno6A=";
stripRoot = false;
};
installPhase = ''
runHook preInstall
install -Dt "$out"/bin "${os}-${arch}"/copilot-language-server
runHook postInstall
'';
dontStrip = true;
passthru.updateScript = nix-update-script { };
meta = {
description = "Use GitHub Copilot with any editor or IDE via the Language Server Protocol";
homepage = "https://github.com/features/copilot";
# license = {
# deprecated = false;
# free = false;
# fullName = "GitHub Copilot Product Specific Terms";
# redistributable = false;
# shortName = "GitHub Copilot License";
# url = "https://github.com/customer-terms/github-copilot-product-specific-terms";
# };
mainProgram = "copilot-language-server";
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
maintainers = with lib.maintainers; [
arunoruto
wattmto
];
};
});
copilot-language-server-fhs = buildFHSEnv {
name = "copilot-language-server";
targetPkgs = pkgs: [
pkgs.stdenv.cc.cc.lib # libstdc++.so.6
# pkgs.zlib # libz.so.1
# pkgs.openssl # libssl.so.3/libcrypto.so.3
];
runScript = "${copilot-language-server}/bin/copilot-language-server";
meta = copilot-language-server.meta // {
description = copilot-language-server.meta.description + " (FHS-wrapped)";
};
};
in
if withFHS then copilot-language-server-fhs else copilot-language-server (The licence was commented out, since it complained that it was unfree during local building) |
Thanks ! I don't have the solution to your question, but have you checked how similar packages are made in |
Editors have sometimes a normal version and a I am starting to believe, that the problem is related to the users nixpkgs version. Folks on stable releases don't have that problem and those using unstable face the issue... Not sure what change unstable introduced that created this problem... |
Let's move on then :) |
Fixes the "dynamically linked executable" error by using
autoPatchelfHook
Remaining Issue: The binary still fails with a Node.js
pkg
error (SyntaxError: Invalid or unexpected token
). This appears to be a problem with the prebuilt binary expecting a traditional FHS structure, which may require additional work (e.g.,buildFHSUserEnv
).Testing Steps:
nix-build -A copilot-language-server
./result/bin/copilot-language-server --version # Still errors, but no "dynamically linked" issue.
Closes #391730 (partially)
Maintainers: @arunoruto @wattmto