Autor Thema: QNAP 64-bit drivers development question  (Gelesen 23531 mal)

virtualdj

  • Newbie
  • *
  • Beiträge: 11
    • Profil anzeigen
QNAP 64-bit drivers development question
« am: April 25, 2015, 04:46:19 Nachmittag »
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!

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8604
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #1 am: April 25, 2015, 05:25:01 Nachmittag »
There are 2 versions of libmediaclient.so one is 32bit the other one has 64bit.
You can pull the specific drivers from our server as you might know:
http://sundtek.de/media/netinst/32bit/installer.tar.gz
http://sundtek.de/media/netinst/64bit/installer.tar.gz

The only important thing is that you match the target application with it (usually the installer will take care about that).

I don't think that we can compile the drivers with a special path for the libraries because it would break the generic support of the driver, so the only way to get around that is to use LD_LIBRARY_PATH to the libraries which are missing.

Aside of that we're also working on our own VCR software for the NAS systems the ETA will be around 3 months, first we are going to implement a player (ETA for the first beta should be within next month).
Failure is a good thing! I'll fix it

virtualdj

  • Newbie
  • *
  • Beiträge: 11
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #2 am: April 25, 2015, 05:34:35 Nachmittag »
There are 2 versions of libmediaclient.so one is 32bit the other one has 64bit.
You can pull the specific drivers from our server as you might know:
http://sundtek.de/media/netinst/32bit/installer.tar.gz
http://sundtek.de/media/netinst/64bit/installer.tar.gz
That's what I just do, otherwise the 32bit libmediaclient.so would not run on the 64bit TVHeadend at all.
I'm just asking if you know why the 64bit spits out that message on every command (in the example, when running "ls").

I don't think that we can compile the drivers with a special path for the libraries because it would break the generic support of the driver, so the only way to get around that is to use LD_LIBRARY_PATH to the libraries which are missing.
Just for my info, why would it break the support if the binaries look for a folder which does not exists (because it's a subfolder of your installation path, "libc" in this case)?
Isn't "$ORIGIN" supported by all the platforms?

Aside of that we're also working on our own VCR software for the NAS systems the ETA will be around 3 months, first we are going to implement a player (ETA for the first beta should be within next month).
Cool! ;D

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8604
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #3 am: April 25, 2015, 05:43:26 Nachmittag »
Let me back-check the ORIGIN option with the developer on Monday.
Failure is a good thing! I'll fix it

virtualdj

  • Newbie
  • *
  • Beiträge: 11
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #4 am: April 25, 2015, 05:47:41 Nachmittag »
Thanks, exporting LD_LIBRARY_PATH is always an hassle and I removed it from TVHeadend QPKG too.

virtualdj

  • Newbie
  • *
  • Beiträge: 11
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #5 am: Mai 05, 2015, 08:48:12 Nachmittag »
Hi Sundtek, have you got any news from the developer?

knusperriegel

  • Newbie
  • *
  • Beiträge: 1
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #6 am: August 25, 2015, 12:03:59 Vormittag »
Hi,

I bought the Sundtek MediaTV Pro III to use it on a QNAP HS-251 FW 4.1.x with tvheadend.
Unfortunately is seems as if the development of the QNAP driver package for 64bit now got stuck, because the developer of the QNAP package (virtualdj) is missing feedback in this thread.

With the 32bit drivers as loaded by the v0.5.1 package and the tvheadend 0.8.4 or 0.8.5 package I'm facing periodic crashes and re-starts of the NAS.
I'd like to continue using the stick & NAS in a stable environment and use future updates of the 64bit tvheadend package.

=> Can you please support the developer and feedback as requested above?

Thanks


Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8604
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #7 am: August 25, 2015, 02:23:40 Vormittag »
Hi,

use the USB 2.0 ports.

The devices cannot crash the system, if it crashes then your system has some issues with the USB 3.0 Controller driver.

We continued this discussion in the chatroom as far as I remember (that's why it did not continue here).
« Letzte Änderung: August 25, 2015, 09:16:49 Vormittag von Sundtek »
Failure is a good thing! I'll fix it

virtualdj

  • Newbie
  • *
  • Beiträge: 11
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #8 am: August 25, 2015, 03:44:42 Nachmittag »
Unfortunately is seems as if the development of the QNAP driver package for 64bit now got stuck, because the developer of the QNAP package (virtualdj) is missing feedback in this thread.
We continued this discussion in the chatroom as far as I remember (that's why it did not continue here).
I confirm. I was in contact with the developer via IRC and I did a simple test on my 64-bit NAS.
Unfortunately, due to the missing libraries on the QNAP, it's not possible to use the Sundtek package in 64-bit mode (hence with 64-bit TVHeadend) without preloading all the binaries with LD_LIBRARY_PATH.

I told the developer that I would have tried to make a 64-bit QPKG with this method, but then I realized that there are no real advantages on doing all that stuff.

I'd like to continue using the stick & NAS in a stable environment and use future updates of the 64bit tvheadend package.
Installing TVHeadend 32-bit with TVH_Dev_Sundtek 32-bit solves the issue and should not cause any crashes (or at least they should not be related to the fact the applications are running in 32-bit mode).

As TVHeadend is not using a lot of RAM (it runs on a NAS), there isn't any drawback to stick with 32-bit mode. QNAP in fact use all the applications in that mode (otherwise the libraries would be available) and keeps the kernel with 64-bit to support large volumes (HDD).

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8604
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #9 am: August 25, 2015, 04:11:42 Nachmittag »
Zitat
Installing TVHeadend 32-bit with TVH_Dev_Sundtek 32-bit solves the issue and should not cause any crashes (or at least they should not be related to the fact the applications are running in 32-bit mode).

just be sure that USB 2.0 ports are used with it then it should be ok, USB 3.0 ports are unreliable at the moment due problems inside the Linux USB 3.0 Controller driver.
Failure is a good thing! I'll fix it

virtualdj

  • Newbie
  • *
  • Beiträge: 11
    • Profil anzeigen
Re:QNAP 64-bit drivers development question
« Antwort #10 am: August 25, 2015, 04:29:25 Nachmittag »
I will make a note on the download thread, then. Thanks.