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
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 0x0050 in ?? ()
#4 0xcfbe0033 in ?? ()
#5 0x01de0033 in ?? ()
#6 0x 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