Skip to content
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

Doesn't work in NixOS #821

Open
3 tasks done
utkukaratas opened this issue Feb 3, 2024 · 21 comments
Open
3 tasks done

Doesn't work in NixOS #821

utkukaratas opened this issue Feb 3, 2024 · 21 comments
Assignees
Labels
bug Something isn't working

Comments

@utkukaratas
Copy link

utkukaratas commented Feb 3, 2024

Before submitting your bug report

Relevant environment info

- OS: NixOS (unstable)
- Continue: v0.8.2
- IDE: VSCODE

Description

VS Code plugin logs:

Activation Event:onStartupFinished
Activation Time:83ms

libstdc++.so.6: cannot open shared object file: No such file or directory

To reproduce

No response

Log output

No response

@utkukaratas utkukaratas added the bug Something isn't working label Feb 3, 2024
@sestinj sestinj self-assigned this Feb 4, 2024
@Geezus42
Copy link

Geezus42 commented Feb 6, 2024

How did you configure VSCode? Could you share the relevant portion?

@functorism
Copy link

Can confirm I'm seeing the same issue on NixOS:

Error: libstdc++.so.6: cannot open shared object file: No such file or directory
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1869)

This is a Nix specific distribution problem to solve, and I'd take a look at building the extension with https://github.com/nix-community/nix-vscode-extensions to resolve the issue. I havent' tried this yet, but will report back when I have time to.

@Raroh73
Copy link

Raroh73 commented Feb 15, 2024

I'm using home-manger's VS Code module and this code works for me:

(pkgs.vscode-utils.buildVscodeMarketplaceExtension {
  mktplcRef = {
    name = "continue";
    publisher = "Continue";
    version = "0.9.61";
    sha256 = "f3538fff6a5f2b5c354e1227907e9ad3127d8fecf3940ddf15598f17f144c14e";
    arch = "linux-x64";
  };
  nativeBuildInputs = [
    pkgs.autoPatchelfHook
  ];
  buildInputs = [ pkgs.stdenv.cc.cc.lib ];
})

It patches binary ELFs for NixOS.

Edit:
If there is demand then I can make PR to nixpkgs.

Edit 2:
I made PR to NixOS that adds VS Code extension: NixOS/nixpkgs#289289.

@icodeforyou-dot-net
Copy link

@Raroh73 I should say this does NOT work for me as is. I just get "Error activating the Continue extension" when starting VSCode. Not sure what is going on there, the log file is empty. Do you have any other config to share to make this work?

@Raroh73
Copy link

Raroh73 commented Feb 20, 2024

@icodeforyou-dot-net
It's all code that I'm using for this extension. I'm not sure why it doesn't work for you but I will try to help. Do you use same version that I specified or different one?

@icodeforyou-dot-net
Copy link

icodeforyou-dot-net commented Feb 20, 2024

Thanks @Raroh73

Yeah, I just added your code snippet to to my programs.vscode.extensions list for home manager. I also tried the newest version. But same things occurs. I also tried to delete all the cached stuff that VSCode might have left somewhere. Not sure I got all of it, but it seems I got most of it at least.

Did you set any custom models or something in settings.json or something like that? In my case the extension appears in the side bar, but I just get a loading animation when opening it. When clicking on the button "Toggle Full Screen" I get a number of error messages. I made a screenshot of those.

Screenshot from 2024-02-20 13-37-22

Edit: I guess for some reason it cannot open the config.json which it needs.

Also the error when activating extension appears to be this from the VSCode debug console. Obviously having a read-only filesystem is somewhat to be expected on NixOS:

[Extension Host] Error activating extension:  Error: EROFS: read-only file system, open '/home/ap/.vscode/extensions/Continue.continue/continue_tutorial.py'
	at Object.openSync (node:fs:605:3)
	at Object.func [as openSync] (node:electron/js2c/asar_bundle:2:2131)
	at Object.writeFileSync (node:fs:2345:35)
	at showTutorial (/nix/store/s5xl38py78xr7xlgp26w31a6xhx2jnkm-vscode-extension-Continue-conti…e-0.9.67/share/vscode/extensions/Continue.continue/out/extension.js:176329:10)
	at openTutorialFirstTime (/nix/store/s5xl38py78xr7xlgp26w31a6xhx2jnkm-vscode-extension-Continue-conti…e-0.9.67/share/vscode/extensions/Continue.continue/out/extension.js:176338:11)
	at activateExtension (/nix/store/s5xl38py78xr7xlgp26w31a6xhx2jnkm-vscode-extension-Continue-conti…e-0.9.67/share/vscode/extensions/Continue.continue/out/extension.js:176367:9)
	at dynamicImportAndActivate (/nix/store/s5xl38py78xr7xlgp26w31a6xhx2jnkm-vscode-extension-Continue-conti…e-0.9.67/share/vscode/extensions/Continue.continue/out/extension.js:176448:11)

@Raroh73
Copy link

Raroh73 commented Feb 20, 2024

@icodeforyou-dot-net
I have very minimal config set but after deleting ~/.continue folder extension properly created default config for me.

Edit:
After seeing your edit I deleted .vscode and .config/Code folders and extension broke for me. I used continue extension before 0.9.61 version and maybe one of updates changed how extension works but I need to test it.

Edit 2:
Version 0.8.12 didn't work but version 0.8.0 worked for me.

Edit 3:
Version 0.8.3 is last release version that works for me.

@icodeforyou-dot-net
Copy link

After seeing your edit I deleted .vscode and .config/Code folders and extension broke for me.

Sorry I broke things for you 🥲

From the error message I got there seems to be some openTutorialFirstTime function running, I guess, the first time you open it. And that errors out. So for some reason you bypassed that. If we could reproduce this bypass, we might have a workaround.

I will try 0.8.3 later and see if this fixes things.

@Raroh73
Copy link

Raroh73 commented Feb 20, 2024

I think it requires write access to extension folder (in nix store) because of this commit. It rewrites keyboard shortcuts in tutorial file basing on running OS. I will need to find a way to bypass first activation somehow.

@icodeforyou-dot-net
Copy link

Well it does set context.globalState.update("continue.tutorialShown", true); at the end. I am just not sure where this globalState is located for future reference. If we knew, we could just put true in there and we should be good to go I'd say.

@Raroh73
Copy link

Raroh73 commented Feb 20, 2024

From my research it looks like globalState is VS Code's database for extensions settings. I don't know if there is proper way to use VS Code api from command line.

@icodeforyou-dot-net
Copy link

@Raroh73 From looking at other VSCode extentions, I believe one might add a postInstall hook like so:

        postInstall = ''
          cd "$out/$installPrefix"
          jq '.contributes.configuration.properties."continue.tutorialShown".default = "true"' package.json | sponge package.json
        '';

However that did not work for me, so I have no idea how to actually do it. But maybe something along these lines?

I should say I tried version 0.8.0 and that one works now with deepseek-coder-1.3b on my local ollama using your config. Very nice.

@Raroh73
Copy link

Raroh73 commented Feb 20, 2024

postInstall = ''
  cd "$out/$installPrefix"
  substituteInPlace "out/extension.js" \
    --replace 'await showTutorial();' '//await showTutorial();'
'';

It disables showTutorial() function so activation can pass. If you want to test it you probably will need to delete all 3 folders so I recommend backing them up.

@icodeforyou-dot-net
Copy link

Great, that sounds like a somewhat hacky workaround! I will delete all three folders without backing them up later and try it! 🤟

(Nix is supposed to make things have less state. So deleting state every once in a while might be a decent idea.) 😄

@icodeforyou-dot-net
Copy link

So I did test it by now and it basically works with newer version @Raroh73 . 🎊 However I managed to break it once more when I reloaded the extension. It got stuck in shoing the loading spinner. I have not been able to reproduce this problem, so I can't say if this is at all related to NixOS. After deleting all VSCode related files once more it went away and the extension now works again.

@Raroh73
Copy link

Raroh73 commented Feb 29, 2024

My PR was merged and now is available on NixOS Unstable.

@lyssieth
Copy link

lyssieth commented Mar 9, 2024

I'd been using VSCode Insiders from AUR before I switched to configuring my VSCode with Nix, so I have a state.vscdb to compare to.

Looks like the best workaround to make openTutorialFirstTime see a true is to do the following:

INSERT INTO ItemTable VALUES('Continue.continue', '{"continue.tutorialShown":true}');

to the ~/.config/Code/User/globalStorage/state.vscdb sqlite file.

Doing that gets even the latest version of Continue loading and working properly (my config is using gpt4-turbo for chat and local ollama for tab autocomplete).

@ciferkey
Copy link

ciferkey commented Apr 3, 2024

Just wanted to say the Intellij Plugin is also not working in NixOS. Should I make a separate issue with the details?

@otopetrik
Copy link

Just wanted to say the Intellij Plugin is also not working in NixOS. Should I make a separate issue with the details?

Providing the libstdc++.so.6 library is not enough, the continue-binary executable has a non-NixOS path to the interpreter /lib64/ld-linux-x86-64.so.2.
Using patchelf does not help, because the binary is sensitive to internal changes (some fixed offsets). Behavior basically matches the following issue. Instead of the solution with top-level `/lib64' directory, use build a wrapper to run the unmodified binary in FHS environment.

NixOS-package Intellij plugin would be nice. For now the following workaround works:

In ~/.local/share/JetBrains/<IDE-version>/continue-intellij-extension/core/linux-x64
rename continue-binary to continue-binary-real. Make sure it is executable, it looks like it is installed without executable bit, and only marked executable later (during plugin start?).

Create continue-binary file with following contents:

#!/usr/bin/env bash
read -r -d '' EXPR <<'EOF'
with import <nixpkgs> { };
pkgs.buildFHSEnv {
  name = "continue-binary";
  runScript = ''./continue-binary-real "$@"'';
}
EOF
$(nix-build --expr "${EXPR}" --no-out-link)/bin/continue-binary "$@"

and chmod +x continue-binary.

@vkopio
Copy link

vkopio commented May 6, 2024

I managed to fix the aforementioned libstdc++ error with nix-ld (using vscode-fhs Nix package), but now the extension crashes with

Extension host (LocalProcess pid: 33180) terminated unexpectedly. Code: 132, Signal: unknown

The last working VSCode extension version is 0.8.11. I tried to inspect changes after that version change, but I did not find a clear mapping between the source code and the extension versions.

Edit: In 0.8.12 the extension crashes when indexing reaches at 33%, and in later prerelease versions the extension crashes at 25%.

@ToyVo
Copy link

ToyVo commented May 27, 2024

Thanks for mentioning vscode-fhs, I didn't realize that was a thing, I was sitting here thinking how am I going to modify the desktop file to add env LD_LIBRARY_PATH=NIX_LD_LIBRARY_PATH to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests