FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 11-10-2008, 12:21 PM
Tim Niemueller
 
Default dlopen()/festival problem

Hi C/C++ developers.

I'm having an interesting problem with Festival on F-9/F-8 and I'm not
sure whether it is a problem with dlopen(), or Festival, or if I'm just
trying something stupid. Maybe someone here has a clue or point me
somewhere I should look into to solve it:

I'm developing a software which uses shared objects (.so) as plugins.
One of those plugins provides speech synthesis via Festival. The problem
is now that it crashes at a very specific position in the speech_tools
library that comes with Festival. There are module-global variables in a
.cc file which are not properly initialized, but only if the lib is
opened via dlopen(). If I put it directly into main, or link the main
program that dlopen()s the festival plugin against the festival lib
everything works fine.

So is it intended that the standard runtime linker and dlopen() work
differently in initializing global variables of a library? Or am I
trying something not meant to work?

I have put code to illustrate the problem at
http://fedorapeople.org/~timn/festival/. To get it working do:

- install festival-devel, festival-speechtools-devel, festival-debuginfo
(if you want to see the backtrace in gdb)

- First as root you have to move some files as the festival package has
a longstanding bug (#242607), which I'm going to fix this as soon as I
got this sorted.
# cd /usr/include/speech_tools
# mv unix/EST/EST_* unix/
# mv instantiate/EST/instantiate/EST_T* instantiate/
# mv sigpr/EST/EST_* sigpr/
# mv ling_class/EST/EST_* ling_class/

- Download all files of the code from
http://fedorapeople.org/~timn/festival/. It has a simple Makefile to
build the code.

- the festival binary simply uses festival and directly links against
festival and should work just fine

- The uselib binary will dlopen() festival_lib.so (which is the custom
plugin and not the festival library itself) and then tries to execute
festival_initialize() where it fails with a segfault which can be traced
down to uninitialized global variables.


Anyone with an idea what's going wrong, what's broken or what I'm trying
that is stupid?

Thank you,
Tim

--
Tim Niemueller <tim@niemueller.de> www.niemueller.de
================================================== ===============
Imagination is more important than knowledge. (Albert Einstein)

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-10-2008, 02:24 PM
Jan Kratochvil
 
Default dlopen()/festival problem

Hi Tim,

On Mon, 10 Nov 2008 14:21:22 +0100, Tim Niemueller wrote:
> So is it intended that the standard runtime linker and dlopen() work
> differently in initializing global variables of a library?

I did not see a problem with this. BTW I would use `g++' instead of
`gcc -lstdc++'.

The problem is in the festival libraries build. They use the default
visibility and their symbol `backtrace':
./speech_tools/siod/slib.cc
LISP backtrace = NIL;
is being overriden by the glibc function `backtrace':
/usr/include/execinfo.h
extern int backtrace (void **__array, int __size) __nonnull ((1));
One apparently cannot write to a .text readonly section as it attempts to.

The package festival should be built with -fvisibility=hidden and specific
global functions/variables marked by `__attribute__ ((visibility("default")))'
as described in `man gcc' -fvisibility and
http://people.redhat.com/drepper/dsohowto.pdf .

As a temporary workaround you may use dlopen() flag RTLD_DEEPBIND.
BTW it is also more effective to use RTLD_LAZY than RTLD_NOW.


Regards,
Jan

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-10-2008, 02:47 PM
John Reiser
 
Default dlopen()/festival problem

BTW it is also more effective to use RTLD_LAZY than RTLD_NOW.


In what way is RTLD_LAZY more effective than RTLD_NOW?

Using RTLD_NOW can make future latencies lower (or at least more
deterministric) by performing most dynamic symbol resolutions
immediately in one big batch. This trades a higher initial cost
(and possibly more total work, if not all the resolutions
will be used) for lower latency in the future.

--

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-10-2008, 04:44 PM
Matthew Miller
 
Default dlopen()/festival problem

On Mon, Nov 10, 2008 at 04:24:54PM +0100, Jan Kratochvil wrote:
> The problem is in the festival libraries build. They use the default
> visibility and their symbol `backtrace':
> ./speech_tools/siod/slib.cc
> LISP backtrace = NIL;
> is being overriden by the glibc function `backtrace':
> /usr/include/execinfo.h
> extern int backtrace (void **__array, int __size) __nonnull ((1));
> One apparently cannot write to a .text readonly section as it attempts to.
>
> The package festival should be built with -fvisibility=hidden and specific
> global functions/variables marked by `__attribute__ ((visibility("default")))'
> as described in `man gcc' -fvisibility and
> http://people.redhat.com/drepper/dsohowto.pdf .
>
> As a temporary workaround you may use dlopen() flag RTLD_DEEPBIND.
> BTW it is also more effective to use RTLD_LAZY than RTLD_NOW.

Can you file this in bugzilla so that I don't forget about it? I'm planning
to do a big update of festival after F10 is out the door.

--
Matthew Miller <mattdm@mattdm.org>
Senior Systems Architect
Cyberinfrastructure Labs
Computing & Information Technology
Harvard School of Engineering & Applied Sciences

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-10-2008, 09:48 PM
Tim Niemueller
 
Default dlopen()/festival problem

> As a temporary workaround you may use dlopen() flag RTLD_DEEPBIND.
> BTW it is also more effective to use RTLD_LAZY than RTLD_NOW.

Thanks a lot Jan, you are my dlopen() hero! That fixed the problem
indeed and everything seems to work fine! Awesome!

Tim

--
Tim Niemueller <tim@niemueller.de> www.niemueller.de
================================================== ===============
Imagination is more important than knowledge. (Albert Einstein)

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-11-2008, 09:08 AM
Tim Niemueller
 
Default dlopen()/festival problem

Matthew Miller schrieb:
> Can you file this in bugzilla so that I don't forget about it? I'm planning
> to do a big update of festival after F10 is out the door.

I filed it as #470995
(https://bugzilla.redhat.com/show_bug.cgi?id=470995) with links to the
ML postings. I have filed it against rawhide. Although I didn't check
the problem on rawhide your mail suggests that not much has changed
since F-9.

If you don't mind I will add a workaround for the include file problem
to the current package and push updates for festival on F-8 to F-10,
because otherwise the -devel packages are completely useless.

Tim

--
Tim Niemueller <tim@niemueller.de> www.niemueller.de
================================================== ===============
Imagination is more important than knowledge. (Albert Einstein)

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 

Thread Tools




All times are GMT. The time now is 01:32 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org