Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Oct 2013 15:44:51 +0800
From:      Christopher Hall <christopherhall.hsw@gmail.com>
To:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   PostgreSQL server bus error with uuid-ossp extension
Message-ID:  <20131004154451.4a11d0dd@hsw-tp>

next in thread | raw e-mail | index | archive | help
When running PostgreSQL with the uuid-ossp extension the server fails
with signal 10 (bus error).

A simple test program that links against the /usr/local/libuuid.a works
correctly.  It call uuid_create(), uuid_make() and prints the uuid
returned.  It was compiled/linked:
  cc -o uuid-test uuid-test.c -I/usr/local/include -L/usr/local/lib
-luuid

ldd shows only libc.so.7, so the libuuid is linked in statically.

By inserting syslog() calls in the libuuid I found that PostgreSQL does
not call the libuuid uuid_create().

My first attempt at a fix was to create a uuid_create_ossp() wrapper
function to call uuid_create() in the uuid library.  Does not work with
PostgreSQL, test was still ok.  

Renaming the uuid_create() to uuid_create_ossp() and having the wrapper
called uuid_create() allows both programs to work.

It looks like the uuid_create() that is called is the FreeBSD one in
libc.  It seems like the libc is taking priority over the 
/usr/local/lib/libuuid.a

Does anyone know of a way to force the linker to chose a symbol from a
specific library?  Or perhaps force the linker to consider all symbols 
from static libraries before proceeding to libc?

-- 
Best regards.
Christopher Hall



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131004154451.4a11d0dd>