Installing ThinLinc, dynamically linked executable

Hi all,

I am trying to get ThinLinc working on Nixos : https://www.cendio.com/thinlinc/download/

Unfortunately, it is packaged as an executable, and I get an error when I try to run it.

Could not start dynamically linked executable: /nix/store/dw875w0n2z65qdm8nnqm9i9dh9rk077k-thinlinc-4.17.0/bin/../lib/tlclient/tl-fontcache
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

I tried packaging it as a mkDerivation, but after fiddling with the installPhase etc etc, I finally arrived at… the same error…

1 Like

Have you looked at the wiki article for this?

You say you tried making a derivation, but do not show your work, so it’s hard for us to tell what you might be doing wrong.

1 Like

Thanks for pointing me to the article. Now I wrote a new derivation, and I get new errors (dependencies not met), but after playing around with different names in buildInputs, I cannot get the library names correct (don’t know where to look for them as well).

Here’s the error:

error: builder for '/nix/store/bjblg9s9xsqv3nv3af1r2dri5bhzmzgd-thinlinc-4.17.0-3543.drv' failed with exit code 1;
       last 10 log lines:
       > setting RPATH to: /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/pulse
       > auto-patchelf: 6 dependencies could not be satisfied
       > error: auto-patchelf could not satisfy dependency libX11.so.6 wanted by /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/vncviewer
       > error: auto-patchelf could not satisfy dependency libX11.so.6 wanted by /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/tl-fontcache
       > error: auto-patchelf could not satisfy dependency libX11.so.6 wanted by /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/tlclient.bin
       > error: auto-patchelf could not satisfy dependency libpcsclite.so.1 wanted by /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/pcsctun
       > error: auto-patchelf could not satisfy dependency libX11.so.6 wanted by /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/pulse/libpulsecore-6.0.so
       > error: auto-patchelf could not satisfy dependency libasound.so.2 wanted by /nix/store/2pnh7chcw83768rrnxbs56hv511qn379-thinlinc-4.17.0-3543/lib/tlclient/pulse/libalsa-util.so
       > auto-patchelf failed to find all the required dependencies.
       > Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`.
       For full logs, run 'nix log /nix/store/bjblg9s9xsqv3nv3af1r2dri5bhzmzgd-thinlinc-4.17.0-3543.drv'.

And here’s my mkDerivation:

{ 
stdenv, 
fetchurl, 
lib,
autoPatchelfHook,
}:

stdenv.mkDerivation rec {
  pname = "thinlinc";
  version = "4.17.0-3543";

  src = fetchurl {
    url = "https://www.cendio.com/downloads/clients/tl-${version}-client-linux-dynamic-x86_64.tar.gz";
    sha256 = "01j5dxi7k7qz31aw4mmfdaqwrdzx6gwhcab3ln1h85wd27ppv6gf";
  };

  # Required for compilation
  nativeBuildInputs = [
    autoPatchelfHook # Automatically setup the loader, and do the magic
  ];
  buildInputs = [  ];

  unpackPhase = ''
    tar -xzf $src
  '';
    
  installPhase = ''
    mkdir -p $out
    cp -r tl-${version}-client-linux-dynamic-x86_64/* $out/
  '';

  meta = with lib; {
    description = "ThinLinc client";
    homepage = "https://www.cendio.com/thinlinc";
    platforms = platforms.all;
  };
}

1 Like

okay, I resolved it, it just needed

  buildInputs = [ 
      libX11
      pcsclite
      alsaLib
  ];

on a side note, can I add my mkDerivation to nixpkgs, so if someone else wants to use ThinLinc, they can install it from nixpkgs?

Here’s also the full script:

{ 
stdenv, 
fetchurl, 
lib,
autoPatchelfHook,
libX11,
pcsclite,
alsaLib
}:

stdenv.mkDerivation rec {
  pname = "thinlinc";
  version = "4.17.0-3543";

  src = fetchurl {
    url = "https://www.cendio.com/downloads/clients/tl-${version}-client-linux-dynamic-x86_64.tar.gz";
    sha256 = "01j5dxi7k7qz31aw4mmfdaqwrdzx6gwhcab3ln1h85wd27ppv6gf";
  };

  # Required for compilation
  nativeBuildInputs = [
    autoPatchelfHook # Automatically setup the loader, and do the magic
  ];
  buildInputs = [ 
      libX11
      pcsclite
      alsaLib
  ];

  unpackPhase = ''
    tar -xzf $src
  '';
    
  installPhase = ''
    mkdir -p $out
    cp -r tl-${version}-client-linux-dynamic-x86_64/* $out/
  '';

  meta = with lib; {
    description = "ThinLinc client";
    homepage = "https://www.cendio.com/thinlinc";
    platforms = platforms.all;
  };
}
1 Like

Yes, see Nixpkgs Reference Manual