Re: gnome_show_url() hangs in threaded programs



On Wed, 29 Aug 2001, Pawel Salek wrote:

>
> On 2001-08-29 02:50 James Henstridge wrote:
> > Do you still see the problems if you link with:
> >   cc atfork-test.c `glib-config --cflags --libs gthread`
> >
> > Or equivalently for 1.3:
> >   cc atfork-test.c `pkg-config --cflags --libs gthread-2.0`
> >
> > If those cases don't work, then report it as a bug.  Relying on the
> > dynamic linker to pull in pthread as a dynamic dependency is asking
> > for trouble.  Various C library functions change behaviour after
> > linking with pthread (for instance, errno changes).
>
> Well, for this *simple* program, it works. For more complex programs,
> which link also against gnome libs, it may not (depending on the linking
> order). There are some more details on this on
>
> http://mail.gnome.org/archives/balsa-list/2001-August/msg00681.html
>
> For example following command line (that includes pthread library!) will
> produce executable that will hang.
>
> # cc atfork-test.c -I/usr/include/glib-1.2 -I/usr/lib/glib/include
> -D_REENTRANT -lglib -lc -lpthread -lgthread
>
> We have spotted this issue in balsa when we used configure-generated
> $GNOME_LIBS, $GLIB_LIBS, $GTK_LIBS (as generated by autoconf macros)
> make variables for linking. It produced working code in some
> configurations, and in other setups, balsa hang on fork.

I don't know why the autoconf macros would be including a -lc in there,
and the ordering looks very odd for the output of one of the standard
macros ("glib-config --libs gthread" and "gtk-config --libs gthread" both
have gthread before pthread for instance).

Linking with libc before libpthread would almost definitely cause
problems, as pthread shadows some functions in libc.

>
> The workaround we use now is to collect a list of used gnome libraries
> and then run gnome-config --libs once with the list.

Alternatively, you can use pkg-config :)

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]