TabNine terminates immediately on NixOS
From https://github.com/TommyX12/company-tabnine/issues/5.
How is this supposed to work?
~/TabNine/1.0.7/x86_64-unknown-linux-gnu $ chmod +x TabNine
~/TabNine/1.0.7/x86_64-unknown-linux-gnu $ ./TabNine
~/TabNine/1.0.7/x86_64-unknown-linux-gnu $
OS info:
- system: `"x86_64-linux"`
- host os: `Linux 4.14.87, NixOS, 18.03.133389.b551f89e256 (Impala)`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.0.4`
- channels(matt): `"nixos-18.03.133236.8edf566ee40, unstable-19.03pre152634.218ce4de508"`
- channels(root): `"nixos-18.03.133389.b551f89e256, unstable-19.03pre162390.86344b3a52b"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixpkgs`
Sorry to hear about this issue. Do you have glibc 2.14?
Hi! Here is my output of ldd --version.
ldd (GNU libc) 2.26
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
I'm not sure what is causing this issue. Could you run TabNine with strace and send the output?
Okay so I've tried the new version and now it's weirder.
[matt@mus:~/TabNine/1.0.10/x86_64-unknown-linux-gnu]$ ls
TabNine
[matt@mus:~/TabNine/1.0.10/x86_64-unknown-linux-gnu]$ ./TabNine
bash: ./TabNine: No such file or directory
[matt@mus:~/TabNine/1.0.10/x86_64-unknown-linux-gnu]$ file TabNine
TabNine: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=53feef4db0112aedd0eb2057b41a571c0e5472c0, stripped
This was the version installed by company-tabnine.
The problem is nixos doesn't support running dynamically linked binaries (at least without patching them first). In particular, /lib64/ld-linux-x86-64.so.2 doesn't exist on nixos. (it is at another path under /nix/store)
Hmmm. What's the best path here? Should we provide a way to install the TabNine binary from the nixpgks repository, and then extend company-tabnine to use an existing TabNine installation?
I did patchelf --set-interpreter /nix/store/84h2zni7h805k0i1ys2bba3dsp1cqnhh-glibc-2.26-131/lib/ld-linux-x86-64.so.2 TabNine, which is hacky. Probably zxqfl should be distributing statically linked binaries.
Ok, I will consider switching to musl (https://rust-lang-nursery.github.io/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html).
That patchelf command did not work for me. I just got warning: working around a Linux kernel bug by creating a hole of 2117632 bytes in ‘TabNine’, and then the same behavior as before.
Hi @zxqfl, any update here? I'm happy to help if you can get me started. It would be nice to get this packaged up in a statically linked binary.
patchelf worked for me with existing glibc path (which, weirdly enough, was shown in ldd TabNine output anyway, suggesting that the binary should have worked). Before that, the error was no such file or directory: ./TabNine.
Thank you @alanpearce that worked for me too!
All future builds of TabNine will have a statically linked version at https://update.tabnine.com/${version}/x86_64-unknown-linux-musl/TabNine. For example, https://update.tabnine.com/2.0.2/x86_64-unknown-linux-musl/TabNine.
Note that the clients for each editor still need to be updated to make the target configurable, as they will run x86_64-unknown-linux-gnu (not statically linked) by default. For the time being, you can overwrite the TabNine binary in x86_64-unknown-linux-gnu with the statically linked binary. This will break automatic updates, but it should otherwise work ok.