Re: C++ Background Workers?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Quinlan Pfiffer <quinlan(at)aquameta(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: C++ Background Workers?
Date: 2014-07-03 21:00:50
Message-ID: 2232.1404421250@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Quinlan Pfiffer <quinlan(at)aquameta(dot)com> writes:
> I'm trying to build a custom background worker for 9.3 in C++.
> Recompiling for -fPIC (as it says to) correctly builds the shared library,
> but then when I try to run Postgres with my .so file being loaded I get
> this:
> https://gist.github.com/qpfiffer/e59c9260b687a23e2743

Is it really necessary to make us go visit some random website for a
two-line error log?

For the archives (since I bet the above link will be 404 soon), the
failure looked like this:

2014-07-03 12:08:42 PDT FATAL: could not load library "/usr/lib/postgresql/9.3/lib/pg_webrtc.so": /usr/lib/postgresql/9.3/lib/pg_webrtc.so: undefined symbol: _Z30BackgroundWorkerUnblockSignalsv

It looks to me like you need extern "C" { ... } around the
Postgres header files you're importing, so that the C++
compiler won't think it should mangle function names
declared therein.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nick Cabatoff 2014-07-03 21:07:37 Why does autovacuum clean fewer rows than I expect?
Previous Message Quinlan Pfiffer 2014-07-03 19:21:21 C++ Background Workers?