# Installing ThinLinc, dynamically linked executable

**URL:** https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048
**Category:** Uncategorized
**Created:** [August 23, 2024, 7:24pm UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048 "2024-08-23T19:24:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Landflier](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/landflier/32/11399_2.png) [@Landflier](https://discourse.nixosstag.fcio.net/u/Landflier)
#### Post date: [August 23, 2024, 7:24pm UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/1 "2024-08-23T19:24:29Z")

</div>

Hi all,

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

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

```auto
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…

---

<div class="post-metadata">

### Author: ![justinas](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/justinas/32/30061_2.png) [@justinas](https://discourse.nixosstag.fcio.net/u/justinas)
#### Post date: [August 23, 2024, 8:59pm UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/2 "2024-08-23T20:59:16Z")

</div>

Have you looked at [the wiki article for this](https://wiki.nixos.org/wiki/Packaging/Binaries)?

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.

---

<div class="post-metadata">

### Author: ![Landflier](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/landflier/32/11399_2.png) [@Landflier](https://discourse.nixosstag.fcio.net/u/Landflier)
#### Post date: [August 23, 2024, 10:43pm UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/3 "2024-08-23T22:43:33Z")

</div>

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:

```auto
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:

```auto
{ 
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;
  };
}

```

---

<div class="post-metadata">

### Author: ![Landflier](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/landflier/32/11399_2.png) [@Landflier](https://discourse.nixosstag.fcio.net/u/Landflier)
#### Post date: [August 24, 2024, 11:38am UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/4 "2024-08-24T11:38:32Z")

</div>

okay, I resolved it, it just needed

```auto
  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:

```auto
{ 
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;
  };
}

```

---

<div class="post-metadata">

### Author: ![emmanuelrosa](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/emmanuelrosa/32/1924_2.png) [@emmanuelrosa](https://discourse.nixosstag.fcio.net/u/emmanuelrosa)
#### Post date: [August 24, 2024, 5:31pm UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/5 "2024-08-24T17:31:11Z")

</div>

Yes, see [Nixpkgs Reference Manual](https://nixos.org/manual/nixpkgs/stable/#part-contributing)

---

<div class="post-metadata">

### Author: ![bach](https://discourse.nixosstag.fcio.net/letter_avatar_proxy/v4/letter/b/c89c15/32.png) [@bach](https://discourse.nixosstag.fcio.net/u/bach)
#### Post date: [April 29, 2025, 2:08am UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/6 "2025-04-29T02:08:26Z")

</div>

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

```auto
       > 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.

---

<div class="post-metadata">

### Author: ![FedericoSchonborn](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/federicoschonborn/32/31264_2.png) [@FedericoSchonborn](https://discourse.nixosstag.fcio.net/u/FedericoSchonborn)
#### Post date: [April 29, 2025, 10:29am UTC](https://discourse.nixosstag.fcio.net/t/installing-thinlinc-dynamically-linked-executable/51048/7 "2025-04-29T10:29:02Z")

</div>

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