Hi

Originally I asked the forwarded question shown below on
m...@openbsd.org and got this answer:

glib2 is now built with threads enabled so anything directly or
indirectly pulling this in (in this case via gtk+2) must either also be
built with threads, or must be run with LD_PRELOAD=/usr/lib/libpthread.so

So my new question is:
What exactly is the reason that it does not load its dependencies on its
own? I think I should not have to care about the dependencies of
gvc/glib2, instead those libs should be linked to them and the system
should load it (even when the library gets loaded dynamically).

Regards,
Reto

-------- Original Message --------
Subject: Crash when using the graphviz library
Date: Thu, 19 May 2011 14:32:39 +0200
From: Reto Schneider <mailinglis...@reto-schneider.ch>
To: m...@openbsd.org

Hi

I have a fresh installation of openBSD 4.9-release where the sample code
of the graphviz library fails. It also fails on openBSD 4.8 but works
perfectly on 4.7/Ubuntu/Debian/FreeBSD/etc.

How to get the error:

Install graphviz:

# export
PKG_PATH="http://mirror.switch.ch/ftp/pub/OpenBSD/4.9/packages/i386/";
# pkg_add -r graphviz


Creating the file sample.c with this content
(http://www.graphviz.org/pdf/libguide.pdf, found at page 40):

#include <gvc.h>
int main(int argc, char **argv)
{
        GVC_t *gvc;
        graph_t *g;
        FILE *fp;
        gvc = gvContext();
        if (argc > 1)
                fp = fopen(argv[1], "r");
        else
                fp = stdin;
        g = agread(fp);
        gvLayout(gvc, g, "dot");
        gvRender(gvc, g, "plain", stdout);
        gvFreeLayout(gvc, g);
        agclose(g);
        return (gvFreeContext(gvc));
}


Compile it (like shown in the example Makefile on page 39):
$ gcc -o sample sample.c `pkg-config --libs --cflags libgvc`


Run it:
$ ulimit -c unlimited
$ echo "graph G{node1;}"|./sample
./sample:/usr/local/lib/libgthread-2.0.so.2600.0: undefined symbol
'pthread_getschedparam'
lazy binding failed!
Segmentation fault (core dumped)


Backtrace:
$ gdb sample sample.core

(gdb) bt
#0  0x01deb370 in _dl_bind () from /usr/libexec/ld.so
#1  0x01de7b87 in _dl_bind_start () from /usr/libexec/ld.so
#2  0x7c9a7628 in ?? ()
#3  0x00000050 in ?? ()
#4  0xcfbe0033 in ?? ()
#5  0x01de0033 in ?? ()
#6  0x00000000 in ?? ()

The workaround I use for now is to link the program sample directly
against pthread:
$ gcc -o sample sample.c `pkg-config --libs --cflags libgvc` -pthread

I have found a commit to the ports which does exactly this for the dot
tool (without this patch it fails like the code above):
http://www.openbsd.org/cgi-bin/cvsweb/ports/math/graphviz/patches/patch-cmd_dot_Makefile_in?rev=1.1;content-type=text%2Fx-cvsweb-markup

Now I am wondering it I did something wrong or if there is a problem
with openBSD 4.8 and 4.9.

Regards,
Reto

Reply via email to