Hi, I'm the same
virtualdj user of the QNAP forum.
If you follow the main TVHeadend thread on the QNAP forums you may have known that TVHeadend application is now a
fully 64-bit application.
So, thanks to QNAP that provided me a 64-bit NAS to test, I'm trying to develop a further version of the Sundtek QPKG to support TVHeadend in 64-bit mode. In fact, at the moment the only possible way is running TVHeadend 32-bit with the 32-bit flavour of the Sundtek drivers.
Now I understand because you asked me to update the script to
support DVBLink package!
At first I tried installing the latest TVH_Dev_Sundtek QPKG and I found I cannot run
mediaclient or the other bins.
[/share/CACHEDEV1_DATA/.qpkg/TVH_Dev_Sundtek/opt/bin] # mediaclient
mediaclient: error while loading shared libraries: librt.so.1: wrong ELF class: ELFCLASS32
That's due to QNAP which does not supply all the complete 64-bit libraries:
[/share/CACHEDEV1_DATA/.qpkg/TVH_Dev_Sundtek/opt/bin] # ldd mediasrv
linux-vdso.so.1 => (0x00007fff1cdfe000)
libdl.so.2 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd4cfff9000)
librt.so.1 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fd4cfc76000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd4d0216000)
[/share/CACHEDEV1_DATA/.qpkg/TVH_Dev_Sundtek/opt/bin] # ls /lib64/
ld-2.11.1.so* libc.so.6*
ld-linux-x86-64.so.2@ libpthread.so.0*
So, to run
mediaclient or
mediasrv both
libdl.so.2 and
librt.so.1 are needed, hence you used LD_LIBRARY_PATH to borrow them from the DVBLink package.
I also had to ship those libraries (and actually the complete
libc) with TVHeadend as it didn't run without them. We can use the same principle with TVHeadend, but I don't like this very much.
So I'm asking: what do you think if we build a QPKG specifically for 64-bit with the two libraries shipped with the QPKG, so that mediaclient can use them and TVH_Dev_Suntek will became standalone again?
I'm asking here because I can of course create a script that sets LD_LIBRARY_PATH before running mediaclient or mediasrv, but I prefer to not use LD_LIBRARY_PATH if possible.
So, do you think you can build the
mediaclient,
mediasrv and
libmediaclient.so files (and others as well) compiled with:
LD_RUN_PATH='$ORIGIN/../libc'
In the future-version QPKG, I can create a
libc folder inside the
opt directory and place the libraries there and then the binaries should work from every path. Of course, if there is no
libc folder, they should work as usual, looking for libraries in the system.
I tried with
patchelf and it's working correctly with '$ORIGIN/../libc', at least for the binary files.
While preloading the libraries on 64-bit NAS gives me always this error:
[~] # LD_PRELOAD=/opt/lib/libmediaclient.so ls
ERROR: ld.so: object '/opt/lib/libmediaclient.so' from LD_PRELOAD cannot be preloaded: ignored.
index_default.html
The same on the 32-bit QNAP doesn't give any error:
[~] # LD_PRELOAD=/opt/lib/libmediaclient.so ls
index_default.html
I cannot explain this behaviour, maybe it's due to the missing libraries too? We'll see!