Autor Thema: Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc  (Gelesen 11549 mal)

Richard Kunze

  • Newbie
  • *
  • Beiträge: 4
    • Profil anzeigen
Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« am: August 13, 2013, 11:14:07 Nachmittag »
Ich möchte meinen DVB-S-Stick (Sundtek SkyTV Ultimate III (USB 2.0)) gerne mit TVHeadend auf einem ARM-OpenWRT-System betreiben. Dabei laufe ich leider auf folgendes Problem:

Der "normale" LD_PRELOAD-Mechanismus für die Einbindung von libmediaclient.so funktioniert nicht, weil die verwendete uClibc ohne Unterstützung für LD_PRELOAD übersetzt wurde. Weil ich ohnehin nur TVHeadend zusammen mit dem Stick verwenden will und TVHeadend sowieso selber übersetze, habe ich alternativ versucht, libmediaclient.so explizit in TVHeadend zu linken. Nach meinem Verständnis sollte das (korrekte Linkreihenfolge vorausgesetzt) eigentlich keinen Unterschied zu LD_PRELOAD machen, und ein Proof-of-Concept auf einem x86-System (Ubuntu 13.04 auf x86-64) funktioniert auch bestens.

Die (Cross-)Compilation für das ARM-System scheitert allerdings daran, daß das von libmediaclient.so verwendet Symbol "__poll" nicht definiert ist.

Details:

Hardware: Iomega ix2-200 (Kirkwood-SOC)
OpenWRT-Version: ATTITUDE ADJUSTMENT (Bleeding Edge, r31555)
uClibc-Version: 0.9.33.2
gcc: 4.6-linaro
Sundtek-Treiber: "openwrtarm4" aus sundtek_installer_130810.165534.sh

Ich habe mediaclient, mediasrv und libmediaclient.so von Hand unter den folgenden Pfaden installiert:

/lib/libmediaclient.so
/bin/mediaclient
/sbin/mediasrv

Der Treiber scheint grundsätzlich auch zu passen, zumindest mediasrv und mediaclient funktionieren soweit ich das beurteilen kann. Ausgabe von mediaclient -e:

**** List of Media Hardware Devices ****
device 0: [Sundtek SkyTV Ultimate III (USB 2.0)]  DVB-S/S2, REMOTE-CONTROL
  [BUS]:
     ID: 1-1.2.1.4
  [SERIAL]:
     ID: U130422145316
  [DVB-S/S2]:
     FRONTEND: /dev/dvb/adapter2/frontend0
     DVR: /dev/dvb/adapter2/dvr0
     DMX: /dev/dvb/adapter2/demux0
  [REMOTECONTROL]:
     INPUT0: /dev/mediainput0

Und last not least der relevante Befehl aus dem Crosscompile (Pfade und Liste der TVHeadend-Object-Files gekürzt):

arm-openwrt-linux-uclibcgnueabi-gcc \
 -o $BUILD_DIR/build.linux/tvheadend \
 $TVHEADEND_OBJECTS \
 -Os -pipe -march=armv5te -mtune=xscale -fno-caller-saves -fhonour-copts \
 -Wno-error=unused-but-set-variable -msoft-float \
 -I$STAGING_DIR/usr/lib/libiconv-stub/include -I$STAGING_DIR/usr/lib/libintl-stub/include \
 -I$STAGING_DIR/usr/include -I$STAGING_DIR/usr/include \
 -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations -Wmissing-prototypes \
 -fms-extensions -g -funsigned-char -O2  -D_FILE_OFFSET_BITS=64 \
 -I$BUILD_DIR/build.linux -I$BUILD_DIR/src -I$BUILD_DIR \
 -L$STAGING_DIR/usr/lib -L$STAGING_DIR/lib \
 -L$TOOLCHAIN_DIR/usr/lib -L$TOOLCHAIN_DIR/lib \
 -L$STAGING_DIR/usr/lib/libiconv-stub/lib \
 -L$STAGING_DIR/usr/lib/libintl-stub/lib  \
 -lmediaclient \
 -L$STAGING_DIR/usr/lib -L$STAGING_DIR/lib \
 -L$TOOLCHAIN_DIR/usr/lib -L$TOOLCHAIN_DIR/lib \
 -L$STAGING_DIR/usr/lib/libiconv-stub/lib \
 -L$STAGING_DIR/usr/lib/libintl-stub/lib \
 -L$STAGING_DIR/usr/lib \
 -lssl -lcrypto \
 -L$STAGING_DIR/usr/lib \
 -lz -lrt -ldl -lpthread -lm

Fehlermeldung:
$STAGING_DIR/lib/libmediaclient.so: undefined reference to `__poll'
« Letzte Änderung: August 13, 2013, 11:19:12 Nachmittag von Richard Kunze »

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re:Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« Antwort #1 am: August 14, 2013, 01:30:44 Vormittag »
Hallo,

melde das Problem bei OpenWRT, wir hatten dies bereits einmal getan (und es wurde eigentlich behoben).
Es ist ein Bug (und wurde auch als Bug anerkannt) das es ausgeschalten ist.

Wir werden das Problem mit __poll dennoch überprüfen.
Failure is a good thing! I'll fix it

Richard Kunze

  • Newbie
  • *
  • Beiträge: 4
    • Profil anzeigen
Re:Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« Antwort #2 am: August 14, 2013, 01:58:18 Vormittag »
Hallo,

melde das Problem bei OpenWRT, wir hatten dies bereits einmal getan (und es wurde eigentlich behoben).
Es ist ein Bug (und wurde auch als Bug anerkannt) das es ausgeschalten ist.

OK, dann prüf ich das mal - eventuell ist es ja auch schon behoben, die Version die ich auf dem Gerät laufen habe ist nicht mehr ganz taufrisch.

Allerdings bin ich mir nicht wirklich sicher ob das auch was bringt - schließlich sollte es ja eigentlich egal sein, ob ich eine Shared Library fest als ersten Eintrag ins Programm linke oder nachträglich per LD_PRELOAD unterschiebe. Der einzige Unterschied dürfte sein, daß im einen Fall wie oben beschrieben der gcc (bzw. genauer: der Linker) das fehlende Symbol anmeckert, und im anderen Fall halt ld.so beim Programmstart auf die Schnauze fliegt. Vom Support von LD_PRELOAD kriegt die uClibc ja nicht plötzlich auf magische Weise ein __poll :-)

Wir werden das Problem mit __poll dennoch überprüfen.

Das wäre nett.

Wenn ich blind raten soll würde ich darauf tippen daß Ihr es euch beim Überladen von poll() einfach gemacht habt und für den Aufruf des "Originals" einfach das glibc-spezifische Äquivalent __poll nehmt statt das sauber über dlsym(RTLD_NEXT, "poll") zu machen. Kann das hinkommen?

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re:Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« Antwort #3 am: August 14, 2013, 02:14:34 Vormittag »
Welche Version verwendest du hier überhaupt? Was zeigt der Installer an?

__poll dürfte eigentlich nicht verwendet werden bei OpenWRT-ARM
Failure is a good thing! I'll fix it

Richard Kunze

  • Newbie
  • *
  • Beiträge: 4
    • Profil anzeigen
Re:Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« Antwort #4 am: August 14, 2013, 02:40:03 Vormittag »
Welche Version verwendest du hier überhaupt? Was zeigt der Installer an?

__poll dürfte eigentlich nicht verwendet werden bei OpenWRT-ARM

Ich verwende "openwrtarm4" (wie vom Installer vorgeschlagen) aus sundtek_installer_130810.165534.sh.

Hier noch ein paar Details zu der enthaltenen libmediaclient.so:

> file opt/lib/libmediaclient.so
opt/lib/libmediaclient.so: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped

> readelf -Ws opt/lib/libmediaclient.so
Symboltabelle ‚.dynsym‛ enthält 94 Einträge:
   Num:    Wert   Size Typ     Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000ef8     0 SECTION LOCAL  DEFAULT    6
     2: 000153b4     0 SECTION LOCAL  DEFAULT   15
     3: 00000000     0 FUNC    GLOBAL DEFAULT  UND clock_gettime
     4: 00000000     0 FUNC    GLOBAL DEFAULT  UND strcpy
     5: 00003004    12 FUNC    GLOBAL DEFAULT    8 __open_2
     6: 00000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_timedlock
     7: 00003010   272 FUNC    GLOBAL DEFAULT    8 ioctl
     8: 00000000     0 FUNC    GLOBAL DEFAULT  UND sysconf
     9: 00000000     0 FUNC    GLOBAL DEFAULT  UND recv
    10: 00000000     0 FUNC    GLOBAL DEFAULT  UND connect
    11: 00000000     0 FUNC    GLOBAL DEFAULT  UND strerror
    12: 00000000     0 FUNC    GLOBAL DEFAULT  UND syscall
    13: 0000d3a8     0 NOTYPE  GLOBAL DEFAULT  ABS __exidx_end
    14: 000016d8   308 FUNC    GLOBAL DEFAULT    8 munmap
    15: 000033dc    36 FUNC    GLOBAL DEFAULT    8 v4l2_mmap
    16: 00000000     0 FUNC    GLOBAL DEFAULT  UND getenv
    17: 00015f04     0 NOTYPE  GLOBAL DEFAULT  ABS _bss_end__
    18: 00000000     0 FUNC    GLOBAL DEFAULT  UND usleep
    19: 00000000     0 FUNC    GLOBAL DEFAULT  UND semget
    20: 00000000     0 FUNC    GLOBAL DEFAULT  UND getpagesize
    21: 00000000     0 FUNC    GLOBAL DEFAULT  UND getpid
    22: 00000000     0 FUNC    GLOBAL DEFAULT  UND __read
    23: 00000000     0 FUNC    GLOBAL DEFAULT  UND shmat
    24: 00000000     0 FUNC    GLOBAL DEFAULT  UND memcpy
    25: 00000000     0 FUNC    GLOBAL DEFAULT  UND puts
    26: 00000000     0 FUNC    WEAK   DEFAULT  UND __cxa_finalize
    27: 00000000     0 FUNC    GLOBAL DEFAULT  UND semctl
    28: 00000000     0 FUNC    GLOBAL DEFAULT  UND system
    29: 00000000     0 FUNC    GLOBAL DEFAULT  UND malloc
    30: 00003120   272 FUNC    GLOBAL DEFAULT    8 v4l2_ioctl
    31: 00000000     0 FUNC    GLOBAL DEFAULT  UND sleep
    32: 0001567c     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start__
    33: 00000000     0 FUNC    GLOBAL DEFAULT  UND socket
    34: 0000136c     4 FUNC    GLOBAL DEFAULT    8 v4l2_fd_open
    35: 00000000     0 FUNC    GLOBAL DEFAULT  UND fflush
    36: 0000d3a0     0 NOTYPE  GLOBAL DEFAULT  ABS __exidx_start
    37: 00003230   428 FUNC    GLOBAL DEFAULT    8 mmap
    38: 00000000     0 FUNC    GLOBAL DEFAULT  UND send
    39: 00000ef8     0 FUNC    GLOBAL DEFAULT    6 _init
    40: 000021d0    12 FUNC    GLOBAL DEFAULT    8 v4l2_dup
    41: 00002ff4    16 FUNC    GLOBAL DEFAULT    8 __open64_2
    42: 00000000     0 FUNC    GLOBAL DEFAULT  UND calloc
    43: 00000000     0 FUNC    GLOBAL DEFAULT  UND fprintf
    44: 000024f8    12 FUNC    GLOBAL DEFAULT    8 v4l2_close
    45: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __deregister_frame_info
    46: 0000180c    12 FUNC    GLOBAL DEFAULT    8 v4l2_munmap
    47: 00000000     0 FUNC    GLOBAL DEFAULT  UND shmdt
    48: 00000000     0 FUNC    GLOBAL DEFAULT  UND shmget
    49: 00015f04     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_end__
    50: 00000000     0 FUNC    GLOBAL DEFAULT  UND strstr
    51: 000021dc   240 FUNC    GLOBAL DEFAULT    8 read
    52: 00000000     0 FUNC    GLOBAL DEFAULT  UND strncmp
    53: 00000000     0 FUNC    GLOBAL DEFAULT  UND strncpy
    54: 00000000     0 FUNC    GLOBAL DEFAULT  UND realloc
    55: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __poll
    56: 00000000     0 FUNC    GLOBAL DEFAULT  UND strdup
    57: 00000000     0 FUNC    GLOBAL DEFAULT  UND gettimeofday
    58: 00000000     0 FUNC    GLOBAL DEFAULT  UND fopen
    59: 0001567c     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
    60: 00000000     0 FUNC    GLOBAL DEFAULT  UND localtime
    61: 00000000     0 FUNC    GLOBAL DEFAULT  UND memset
    62: 00000000     0 FUNC    GLOBAL DEFAULT  UND lockf
    63: 00000000     0 FUNC    GLOBAL DEFAULT  UND fclose
    64: 00002fa8    76 FUNC    GLOBAL DEFAULT    8 open64
    65: 00000000     0 FUNC    GLOBAL DEFAULT  UND time
    66: 00001b80   668 FUNC    GLOBAL DEFAULT    8 poll
    67: 00015f04     0 NOTYPE  GLOBAL DEFAULT  ABS __end__
    68: 00000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_unlock
    69: 00002114   188 FUNC    GLOBAL DEFAULT    8 dup
    70: 0000c890     0 FUNC    GLOBAL DEFAULT    9 _fini
    71: 00000000     0 FUNC    GLOBAL DEFAULT  UND sprintf
    72: 00000000     0 OBJECT  GLOBAL DEFAULT  UND stderr
    73: 00001e1c   760 FUNC    GLOBAL DEFAULT    8 mmap64
    74: 00000000     0 FUNC    GLOBAL DEFAULT  UND strftime
    75: 00000000     0 FUNC    GLOBAL DEFAULT  UND stat
    76: 00000000     0 FUNC    GLOBAL DEFAULT  UND fwrite
    77: 00000000     0 FUNC    GLOBAL DEFAULT  UND __close
    78: 0001567c     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
    79: 00015f04     0 NOTYPE  GLOBAL DEFAULT  ABS _end
    80: 00000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_destroy
    81: 00000000     0 FUNC    GLOBAL DEFAULT  UND __errno_location
    82: 00000000     0 FUNC    GLOBAL DEFAULT  UND semop
    83: 0000195c   256 FUNC    GLOBAL DEFAULT    8 __read_chk
    84: 00000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_init
    85: 00000000     0 FUNC    GLOBAL DEFAULT  UND strlen
    86: 00002e54   340 FUNC    GLOBAL DEFAULT    8 open
    87: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    88: 00000000     0 FUNC    GLOBAL DEFAULT  UND fcntl
    89: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __register_frame_info
    90: 000022cc   556 FUNC    GLOBAL DEFAULT    8 close
    91: 00000000     0 FUNC    GLOBAL DEFAULT  UND vfprintf
    92: 00000000     0 FUNC    GLOBAL DEFAULT  UND raise
    93: 00000000     0 FUNC    GLOBAL DEFAULT  UND free

"__poll" (undefiniert) ist Eintrag 55 in der Symboltabelle.
« Letzte Änderung: August 14, 2013, 02:41:37 Vormittag von Richard Kunze »

Sundtek

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 8512
    • Profil anzeigen
Re:Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« Antwort #5 am: August 14, 2013, 02:46:46 Vormittag »
Tatsache, hatte wohl an der falschen Stelle nachgesehen, hab's gefunden.


Hab das hier soweit entfernt (die Datei wird dann nach dem kommenden Update wieder vom Server entfernt):

http://sundtek.de/support/libmediaclient.so

Das offizielle Update wird dann morgen/heute im Laufe des Tages kommen.
« Letzte Änderung: August 14, 2013, 02:55:30 Vormittag von Sundtek »
Failure is a good thing! I'll fix it

Richard Kunze

  • Newbie
  • *
  • Beiträge: 4
    • Profil anzeigen
Re:Problem mit tvheadend und libmediaclient.so auf OpenWRT/arm/uClibc
« Antwort #6 am: August 14, 2013, 03:26:09 Vormittag »
Jepp, das wars - mit der neuen libmediaclient.so klappt das linken, und TVHeadend auf meiner ARM-Box scannt gerade fleißig die Kanäle auf Astra 19.2E.

Besten Dank für den klasse Support!