IP-Phone-Forum  

Zurück   IP-Phone-Forum > VoIP-Hardware > AVM > FRITZ!Box Fon: Modifikationen > Freetz
Registrieren Hilfe Benutzerliste Wiki Suchen Heutige Beiträge Alle Foren als gelesen markieren

Freetz Paket- und Mod-Entwicklung für die FBF

Antwort
 
Themen-Optionen Thema durchsuchen Ansicht
Alt 30.04.2010, 17:53   #1
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
Getting C++ exception handling to work

I am struggling to get s3fslite to work (see ticket #796). It compiles and runs, but as soon an exception occurs it aborts. Exceptions are part of the normal flow of this package, so this is a problem. I tried a lot of things, but cannot get exception handling to work. Has anybody an idea how to solve this?
M66B ist offline   Mit Zitat antworten
Alt 01.05.2010, 16:37   #2
linuxkasten
IPPF-Fünfhundert-Club
 
Registriert seit: 02.02.2009
Beiträge: 624
Did you use uclibc++?
Maybe you should try to use glib2 (available in freetz-libraries) instead of uclibc++ for building your application.
__________________
MfG,
linuxkasten
___________________________________
FritzBox WLan 3170 mit serieller Konsole - Firmware:
- auf der Box: 7170-Alien-3170 49.04.80freetz-devel-xxxx (relativ aktueller trunk); - absolut minimales usbroot-Image ohne DSL, WLAN, etc., weils sonst Platzprobleme bzw. sogar Probleme beim Booten ála "No init found..." gibt.
- auf dem USB-Stick-rootfs: 7170-Alien-3170 49.04.80freetz-devel-xxxx (relativ aktueller trunk); Pakete: ein ganzer Haufen, da ich an Featuritis leide und diese durch den vielen Platz auch ausleben kann
Buildsystem: gentoo amd64


HaltOnLan - PC remote durch Fritzbox herunterfahren/neustarten/sperren etc.

Geändert von linuxkasten (02.05.2010 um 17:28 Uhr).
linuxkasten ist offline   Mit Zitat antworten
Alt 01.05.2010, 19:13   #3
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
Thanks for the tip, but the problem didn't go away .
Maybe other libraries depend on uClibc++, since ldd outputs:
Code:
libglib-2.0.so.0 => /usr/lib/freetz/libglib-2.0.so.0 (0x2aabe000)
libfuse.so.2 => /usr/lib/freetz/libfuse.so.2 (0x2ab7a000)
libcurl.so.4 => /usr/lib/freetz/libcurl.so.4 (0x2aba8000)
libxml2.so.2 => /usr/lib/freetz/libxml2.so.2 (0x2abfa000)
libcrypto.so.0.9.8 => /usr/lib/freetz/libcrypto.so.0.9.8 (0x2ad19000)
libsqlite3.so.0 => /usr/lib/freetz/libsqlite3.so.0 (0x2ae2e000)
libpthread.so.0 => /lib/libpthread.so.0 (0x2aecf000)
libssl.so.0.9.8 => /usr/lib/freetz/libssl.so.0.9.8 (0x2aef3000)
libdl.so.0 => /lib/libdl.so.0 (0x2af3f000)
libz.so.1 => /usr/lib/freetz/libz.so.1 (0x2af52000)
libuClibc++.so.0 => /usr/lib/freetz/libuClibc++.so.0 (0x2af75000)
libc.so.0 => /lib/libc.so.0 (0x2afaf000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2b065000)
libpcre.so.0 => /usr/lib/freetz/libpcre.so.0 (0x2b083000)
libintl.so.8 => /usr/lib/freetz/libintl.so.8 (0x2b0c0000)
libm.so.0 => /lib/libm.so.0 (0x2b0d8000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
I have attached a new patch to the ticket, with the glib dependency.
M66B ist offline   Mit Zitat antworten
Alt 01.05.2010, 19:36   #4
linuxkasten
IPPF-Fünfhundert-Club
 
Registriert seit: 02.02.2009
Beiträge: 624
That´s true. AFAIK uclibc++ wont support exceptions in the future since it would bloat it too much.
__________________
MfG,
linuxkasten
___________________________________
FritzBox WLan 3170 mit serieller Konsole - Firmware:
- auf der Box: 7170-Alien-3170 49.04.80freetz-devel-xxxx (relativ aktueller trunk); - absolut minimales usbroot-Image ohne DSL, WLAN, etc., weils sonst Platzprobleme bzw. sogar Probleme beim Booten ála "No init found..." gibt.
- auf dem USB-Stick-rootfs: 7170-Alien-3170 49.04.80freetz-devel-xxxx (relativ aktueller trunk); Pakete: ein ganzer Haufen, da ich an Featuritis leide und diese durch den vielen Platz auch ausleben kann
Buildsystem: gentoo amd64


HaltOnLan - PC remote durch Fritzbox herunterfahren/neustarten/sperren etc.
linuxkasten ist offline   Mit Zitat antworten
Alt 01.05.2010, 20:20   #5
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
I was afraid of this, so I have rewritten a lot of code to not use exceptions. A patch is attached to the ticket.
M66B ist offline   Mit Zitat antworten
Alt 02.05.2010, 00:19   #6
er13
IPPF-Fan
 
Registriert seit: 20.12.2005
Beiträge: 251
uClibc++ _does_ support exceptions, it's however broken now... I am not sure whether it's uClibc++' or freetz' fault... I'll look into it as soon as I have some time...

glib2 is a (very good) c-library, it has nothing to do with the implementation of "Standard C++ Library" (see C++ Standard) provided by uClibc++, i.e. they are not interchangeable.
er13 ist offline   Mit Zitat antworten
Alt 02.05.2010, 08:57   #7
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
I would be gratefull if you looked into this. It will make cross-compiling C++ packages that use exceptions a lot easier in general. Now it is more like cross-patching.
M66B ist offline   Mit Zitat antworten
Alt 02.05.2010, 12:38   #8
linuxkasten
IPPF-Fünfhundert-Club
 
Registriert seit: 02.02.2009
Beiträge: 624
Zitat:
Zitat von er13 Beitrag anzeigen
glib2 is a (very good) c-library, it has nothing to do with the implementation of "Standard C++ Library"
Yes, I´m sorry i´ve mixed it up.
__________________
MfG,
linuxkasten
___________________________________
FritzBox WLan 3170 mit serieller Konsole - Firmware:
- auf der Box: 7170-Alien-3170 49.04.80freetz-devel-xxxx (relativ aktueller trunk); - absolut minimales usbroot-Image ohne DSL, WLAN, etc., weils sonst Platzprobleme bzw. sogar Probleme beim Booten ála "No init found..." gibt.
- auf dem USB-Stick-rootfs: 7170-Alien-3170 49.04.80freetz-devel-xxxx (relativ aktueller trunk); Pakete: ein ganzer Haufen, da ich an Featuritis leide und diese durch den vielen Platz auch ausleben kann
Buildsystem: gentoo amd64


HaltOnLan - PC remote durch Fritzbox herunterfahren/neustarten/sperren etc.
linuxkasten ist offline   Mit Zitat antworten
Alt 02.05.2010, 17:43   #9
er13
IPPF-Fan
 
Registriert seit: 20.12.2005
Beiträge: 251
I have investigated the issue a bit. It seems it's a uClibc++ fault as my test program linked against libstdc++ catches all exceptions as expected whereas the same program linked against uClibc++ terminates after throwing the very first exception.

uClibc++ however doesn't implement exception handling itself. It declares all required functions and copies/steals their implementations from libstdc++ by extracting required object files from libsupc++.a and libgcc_eh.a (see src/abi folder). So the implementation is actually exactly the same as that contained in libstdc++. I assume that uClibc++ doesn't initialize some internal structures or whatever and that's the reason it doesn't work. I however didn't manage yet to find out what exactly is going wrong.

gdb produces the following output:
Code:
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mipsel-linux-uclibc"...
(gdb) run
Starting program: /var/media/ftp/uStor01/excepttest
Starting exception testing
Throwing out of range
terminate called after throwing an instance of 'std::out_of_range'
  what():  This is text

Program received signal SIGABRT, Aborted.
0x2ab1c694 in kill () from /lib/libc.so.0
(gdb) bt
#0  0x2ab1c694 in kill () from /lib/libc.so.0
#1  0x2ab5f968 in abort () from /lib/libc.so.0
#2  0x2aaec6dc in __gnu_cxx::__verbose_terminate_handler () from ./libuClibc++.so.0
#3  0x2aaea0b4 in __cxxabiv1::__terminate () from ./libuClibc++.so.0
#4  0x2aaea118 in std::terminate () from ./libuClibc++.so.0
#5  0x2aaea2ec in __cxa_throw () from ./libuClibc++.so.0
#6  0x00400ed8 in main (argc=<value optimized out>, argv=<value optimized out>) at excepttest.c:13
(gdb)
I should probably compile gcc or at least libsupc++ and libgcc_eh with debug information enabled to get more information as reading gcc's source code alone doesn't bring me any further as all this unwind/exception stuff is absolutely new to me...

I already contacted the maintainer of uClibc++, let's see what he suggests.

For those of you who'd like to investigate the issue by themselves here is the link that might be interesting. Also take a look at the source code of gcc in particular at that located in libstdc++-v3/libsupc++.

p.s. I have already looked at openwrt and incorporated some patches from them but it still doesn't solve the issue.
er13 ist offline   Mit Zitat antworten
Alt 03.05.2010, 08:15   #10
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
Thanks for your effort, er13!
I understand that it could/should work, so that's hopeful.
Lets wait what the maintainer of uClibc++ says.
Do you know if exceptions work in openwrt?
__________________
Fritz!Box 7270 int. with mostly latest trunk version, running aiccu, AVM-Firewall, dns2tcp, dnsmasq, dropbear, nsfd, radvd, RRDstats, rsync, Polipo, STunnel, Syslogd, Transmission, vnstat, vsftpd, testing ImapProxy, s3fslite
M66B ist offline   Mit Zitat antworten
Alt 03.05.2010, 21:29   #11
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
Maybe a patch similar to this one is what is needed?
__________________
Fritz!Box 7270 int. with mostly latest trunk version, running aiccu, AVM-Firewall, dns2tcp, dnsmasq, dropbear, nsfd, radvd, RRDstats, rsync, Polipo, STunnel, Syslogd, Transmission, vnstat, vsftpd, testing ImapProxy, s3fslite
M66B ist offline   Mit Zitat antworten
Alt 15.05.2010, 02:52   #12
er13
IPPF-Fan
 
Registriert seit: 20.12.2005
Beiträge: 251
The attached patch solves the issue for me (tested on my 7170 only). Could someone please test it on an uClibc-0.9.28 based box, I lent mine at the moment. Thanks!
Angehängte Dateien
Dateityp: txt uClibcxx_exceptions_fix.patch.txt (1,4 KB, 9x aufgerufen)
__________________
Fritz!Box Fon WLAN 7170v2, Firmware 29.04.80freetz-trunk-5695M
er13 ist offline   Mit Zitat antworten
Alt 15.05.2010, 08:36   #13
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
Thanks again for your efforts, er13!

Unfortunately I cannot test with uClibc-0.9.28, but I will definitely test with s3fslite (as soon as the repositories are back online).
__________________
Fritz!Box 7270 int. with mostly latest trunk version, running aiccu, AVM-Firewall, dns2tcp, dnsmasq, dropbear, nsfd, radvd, RRDstats, rsync, Polipo, STunnel, Syslogd, Transmission, vnstat, vsftpd, testing ImapProxy, s3fslite
M66B ist offline   Mit Zitat antworten
Alt 16.05.2010, 12:25   #14
M66B
IPPF-Fan
 
Benutzerbild von M66B
 
Registriert seit: 17.02.2010
Ort: Dordrecht
Beiträge: 104
I tested with s3fslite with the exceptions in place and it seems to work!

If others want to try this: you have to do a 'make distclean' to rebuilt the toolchain.

I will publish a new patch for s3fslite as soon as the repositories are back online.
__________________
Fritz!Box 7270 int. with mostly latest trunk version, running aiccu, AVM-Firewall, dns2tcp, dnsmasq, dropbear, nsfd, radvd, RRDstats, rsync, Polipo, STunnel, Syslogd, Transmission, vnstat, vsftpd, testing ImapProxy, s3fslite
M66B ist offline   Mit Zitat antworten
Alt 16.05.2010, 12:29   #15
olistudent
Semi-Moderator
 
Benutzerbild von olistudent
 
Registriert seit: 19.10.2004
Ort: Kaiserslautern
Beiträge: 11.059
@er13
Can you please explain what the option "IMPORT_LIBGCC_EH" does?

Regards
Oliver
__________________
Router: Fritz!Box Fon WLAN 7270 FW: 54.04.80, Fritz!Box WLAN 3170 49.04.80 (Alien) und Fritz!Box Fon WLAN FW:08.04.34, jeweils mit Freetz
Anbindung: T-Net mit T-DSL 1000 und 1&1 DSL VoIP: 1&1/Sipgate Telefon: Siemens Gigaset CX 253

#fritzbox on IRCnet!
Spenden für Freetz
olistudent ist gerade online   Mit Zitat antworten
Alt 16.05.2010, 15:03   #16
er13
IPPF-Fan
 
Registriert seit: 20.12.2005
Beiträge: 251
It causes some (not all) of the object files from gcc's libgcc_eh.a to be extracted and linked in libuClibc++.so - this is the way uClibc++ "implements" exception handling, it doesn't actually implement it itself, it "steals/borrows" object files with required symbols from gcc.

I actually didn't manage to find out what exactly goes wrong. Fact is all required symbols are already contained in libgcc_s.so, so linking them in libuClibc++.so is unnecessary as each dynamically linked binary gets libgcc_s.so linked in. It is also not necessary to put them in libuClibc++.a as each statically linked binary gets gcc_eh linked in (the uclibc-g++-wrapper-script contains -lgcc_eh).
er13 ist offline   Mit Zitat antworten
Antwort




Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge anzufügen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

vB Code ist An.
Smileys sind An.
[IMG] Code ist An.
HTML-Code ist Aus.

Ähnliche Themen
Thema Erstellt von Forum Antworten Letzter Beitrag
How work VOIP over AVM VPN? vpe FRITZ!Box Fon: Telefonie 4 03.06.2010 20:18
external 'nano' and 'libncurses', doesn't work ramik Freetz 9 21.11.2009 23:09
Return call Handling awo Asterisk Allgemein 3 05.09.2008 09:42
[Bug 0.4.2?] Java Exception auf Linux 64Bit Felix42 JFritz 3 03.08.2005 23:12


Alle Zeitangaben in WEZ +2. Es ist jetzt 12:05 Uhr.


Powered by vBulletin Version 3.6.8 (Deutsch)
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.