How to fix hard encoding path of binary file

After building, my program can not work, I find:

$ rg --binary /opt/netease/netease-cloud-music/libs/qcef result
result/netease-cloud-music/libs/libqcef.so.1.1.4: binary file matches (found "\0" byte around offset 7)

I have found copy all file to /opt can make it work. However, it is correct solution for nix. I try

  installPhase = ''
    ...
    sed -i 's=/opt/netease/netease-cloud-music/libs/==g' "$out/netease-cloud-music/libs/libqcef.so.1.1.4"
  '';

However, it make autoPatchelfHook cannot work:

auto-patchelf: 1 dependencies could not be satisfied
error: auto-patchelf could not satisfy dependency libqcef.so.1 wanted by /nix/store/z6qg5911bw1hcagzwn4zgj9kz7s6nsh9-netease-cloud-music-1.2.1/netease-cloud-music/netease-cloud-music

It looks sed do something which make auto-patchelf don’t recognize libqcef.so.

How to fix it?

You also need to provide a libqcef.so that patchelf can use in place of the previous one…