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

I’m trying to build the same derivation but I’m getting this long list of errors noBrokenSymlinks
Have you done anything else different?

I’m trying to build v.4.18.0-3768

Thanks

       > ERROR: noBrokenSymlinks: the symlink /nix/store/5c6mm04bx4j485g5wrl2s9xxh838y0f0-thinlinc-4.18.0-3768/lib/tlclient/lib/.build-id/92/ef36e70541fd1031b528a16e4e8e4c9e8452b7 points to a missing target: /nix/store/5c6mm04bx4j485g5wrl2s9xxh838y0f0-thinlinc-4.18.0-3768/lib/opt/thinlinc/lib/tlclient/pulse/module-alsa-sink.so
       > ERROR: noBrokenSymlinks: the symlink /nix/store/5c6mm04bx4j485g5wrl2s9xxh838y0f0-thinlinc-4.18.0-3768/lib/tlclient/lib/.build-id/8e/0b991d406130a9daf4b3422c13cdaf22570a91 points to a missing target: /nix/store/5c6mm04bx4j485g5wrl2s9xxh838y0f0-thinlinc-4.18.0-3768/lib/opt/thinlinc/lib/tlclient/pulse/module-tunnel-source-new.so
       > ERROR: noBrokenSymlinks: the symlink /nix/store/5c6mm04bx4j485g5wrl2s9xxh838y0f0-thinlinc-4.18.0-3768/lib/tlclient/lib/.build-id/36/40d3ee9574a8ee711016e9775c42b8124a3880 points to a missing target: /nix/store/5c6mm04bx4j485g5wrl2s9xxh838y0f0-thinlinc-4.18.0-3768/lib/opt/thinlinc/lib/tlclient/pulse/module-suspend-on-idle.so
       > ERROR: noBrokenSymlinks: found 27 dangling symlinks, 0 reflexive symlinks and 0 unreadable symlinks

Edit: interesting… nix-build didn’t produce the ./result file but it actually build tlclient despite the Errors. I can actually launch it directly from the nix store. Still looking for a way to avoid those Errors though.

You can pass dontCheckForBrokenSymlinks = true; to mkDerivation for the time being and fix it up later.