Re: BUG #14215: External C function link failed on Mac OSX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: max(dot)fomitchev(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14215: External C function link failed on Mac OSX
Date: 2016-06-26 15:22:55
Message-ID: 24492.1466954575@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

max(dot)fomitchev(at)gmail(dot)com writes:
> Linking:
> c++ -shared -o ttt.dylib main.o

This is not a PG bug. Having said that, the above is never going to
work on OS X; it has its own ideas about how to do things. Instead
of "-shared" you need "-bundle -bundle_loader /path/to/postgres",
and there are some other linker flags that are advisable too.
Also, PG expects the file extension for loadable modules to be .so
even on OSX.

It's usually better to use PGXS to build extensions, instead of
learning such details for yourself:
https://www.postgresql.org/docs/9.5/static/extend-pgxs.html
Or you can crib from one of the extensions in the contrib/
source tree.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-06-27 14:54:39 Re: BUG #14210: filter by "=" constraint doesn't work when hash index is present on a column
Previous Message max.fomitchev 2016-06-26 09:27:21 BUG #14215: External C function link failed on Mac OSX