Strange ldd output on patched file: empty library name in front of the "not found"

I’m trying to package teamviewer from the .tar.gz version (the other version does not connect anymore), and one file is patched in a strange way: ldd displays no name in front of the => not found text, and I’ve many errors no version information available (hidden in the [...]). Moreover, ldd on the patched file does not show me any library, while I would expect many libraries to be visible (the original file shows many libraries, see below):

$ ldd /nix/store/ymby963c61xpvz0kd5r8n2gir361lj06-teamviewer-0.0/bin/tv_bin/.teamviewer-config-wrapped
/nix/store/ymby963c61xpvz0kd5r8n2gir361lj06-teamviewer-0.0/bin/tv_bin/.teamviewer-config-wrapped: /nix/store/ymby963c61xpvz0kd5r8n2gir361lj06-teamviewer-0.0/bin/tv_bin/.teamviewer-config-wrapped: no version information available (required by /nix/store/ymby963c61xpvz0kd5r8n2gir361lj06-teamviewer-0.0/bin/tv_bin/.teamviewer-config-wrapped)
[...]
 linux-vdso.so.1 (0x00007ffff47fa000)
  => not found
  => not found

Similarly, when I run teamviewer license, I get an error about a missing library, but again no name is written:

/nix/store/ymby963c61xpvz0kd5r8n2gir361lj06-teamviewer-0.0/bin/tv_bin/teamviewer-config: error while loading shared libraries: : cannot open shared object file: No such file or directory

The pre-patched version does not have this strange empty library name, all “not found” library are mapped to a precise library:

 
 linux-vdso.so.1 (0x00007fff68d23000)
 librt.so.1 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/librt.so.1 (0x00007f0f2318d000)
 libdl.so.2 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/libdl.so.2 (0x00007f0f23188000)
 libQt5Quick.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5Quick.so.5 (0x00007f0f22b4d000)
 libQt5Gui.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5Gui.so.5 (0x00007f0f224a8000)
 libQt5Qml.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5Qml.so.5 (0x00007f0f21f1d000)
 libQt5Network.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5Network.so.5 (0x00007f0f21950000)
 libQt5Core.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5Core.so.5 (0x00007f0f21174000)
 libQt5WebEngineCore.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5WebEngineCore.so.5 (0x00007f0f1be6c000)
 libQt5X11Extras.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5X11Extras.so.5 (0x00007f0f1bc67000)
 libpthread.so.0 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/libpthread.so.0 (0x00007f0f1bc46000)
 libm.so.6 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/libm.so.6 (0x00007f0f1bb01000)
 libc.so.6 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/libc.so.6 (0x00007f0f1b940000)
 /lib64/ld-linux-x86-64.so.2 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib64/ld-linux-x86-64.so.2 (0x00007f0f2319a000)
 libQt5QmlModels.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5QmlModels.so.5 (0x00007f0f1b6da000)
 libGL.so.1 => not found
 libGL.so.1 => not found
 libz.so.1 => not found
 libz.so.1 => not found
 libz.so.1 => not found
 libicui18n.so.63 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/../../libicui18n.so.63 (0x00007f0f1b25f000)
 libicuuc.so.63 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/../../libicuuc.so.63 (0x00007f0f1aeb8000)
 libicudata.so.63 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/../../libicudata.so.63 (0x00007f0f1acb7000)
 libgthread-2.0.so.0 => not found
 libglib-2.0.so.0 => not found
 libQt5WebChannel.so.5 => /home/leo/Documents/Logiciels/Nix_bidouille/Teamviewer/tv_bin/RTlib/qt/lib/libQt5WebChannel.so.5 (0x00007f0f1aa96000)
 libGL.so.1 => not found
 libnss3.so => not found
 libnssutil3.so => not found
 libsmime3.so => not found
 libsoftokn3.so => not found
 libplds4.so => not found
 libplc4.so => not found
 libnspr4.so => not found
 libz.so.1 => not found
 libX11-xcb.so.1 => not found
 libxcb.so.1 => not found
 libxcb-dri3.so.0 => not found
 libXcomposite.so.1 => not found
 libXcursor.so.1 => not found
 libXdamage.so.1 => not found
 libXext.so.6 => not found
 libXfixes.so.3 => not found
 libXi.so.6 => not found
 libXrender.so.1 => not found
 libX11.so.6 => not found
 libXtst.so.6 => not found
 libresolv.so.2 => /nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/libresolv.so.2 (0x00007f0f1aa76000)
 libuuid.so.1 => not found
 libXrandr.so.2 => not found
 libxkbcommon.so.0 => not found
 libXss.so.1 => not found
 libdbus-1.so.3 => not found
 libminizip.so.1 => not found
 libGL.so.1 => not found

Any idea what’s going wrong and how to fix it?

If someone wants to reproduce it, here is the code I’m using. I just don’t have yet an automatic way to download the sources, so anyone using this must first extract manually the .tar.gz 64 bits (version for other distributions) teamviewer file in the current folder. Note that this is quite ugly because I tried to paste all libraries I could think of, and it’s far from being complete.

{ lib
, mkDerivation
, stdenv
, fetchFromGitHub
, libxkbcommon
, autoPatchelfHook
, xorg
, libXdamage
, libXcomposite
, libSM
, libXext
, libICE
, glib
, libGL
, dbus
, fontconfig
, freetype
, libXScrnSaver # libXss
, libXrender
, libXtst
, libXi
, libXcursor
, libXrandr
, minizip
, nspr
, nss
, wrapQtAppsHook
, qtbase
, qtwebkit
, qtx11extras
, qtquickcontrols
}:

mkDerivation rec {
  pname = "teamviewer";
  version = "0.0";
  autoPatchelfIgnoreMissingDeps = true;
  src = ./.;
  nativeBuildInputs = [
    autoPatchelfHook
    wrapQtAppsHook
  ];
  buildInputs = [
    libxkbcommon
    xorg.libX11
    libXdamage
    libXcomposite
    glib
    libGL
    libICE
    libSM
    libSM
    libXScrnSaver
    libXrender
    libXtst
    libXi
    libXcursor
    libXrandr
    minizip
    nspr
    nss
    # Not sure which ones are required or not... let's put them all
    xorg.libX11 # libX11-xcb.so
    xorg.libxcb # libxcb-shm.so
    xorg.xcbutilwm # libxcb-icccm.so
    xorg.xcbutil # libxcb-util.so
    xorg.xcbutilimage # libxcb-image.so
    xorg.xcbutilkeysyms # libxcb-keysyms.so
    xorg.xcbutilrenderutil # libxcb-renderutil.so
    xorg.xcbutilrenderutil # libxcb-renderutil.so
    dbus # libdbus-1.so
    libxkbcommon # libxkbcommon-x11.so
    fontconfig
    freetype
    # https://github.com/NixOS/nixpkgs/blob/8284fc30c84ea47e63209d1a892aca1dfcd6bdf3/pkgs/applications/networking/remote/teamviewer/default.nix
    dbus qtbase qtwebkit qtx11extras
  ];

  buildPhase = ''
    # patchelf fails to patch it... let's try to remove it...
    rm tv_bin/script/libdepend
    rm -r d
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp -r * $out/bin
    rm -rf $out/bin/config
    ln -s /tmp/teamviewer $out/bin/config
    rm -rf $out/bin/logfiles
    ln -s /tmp/teamviewer $out/bin/logfiles
  '';
}