PostgreSQL server bus error with uuid-ossp extension

Christopher Hall christopherhall.hsw at gmail.com
Fri Oct 4 07:45:01 UTC 2013


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


More information about the freebsd-ports mailing list