Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
701 stars 145 forks source link

Multicorn fails to build correctly for a PostgreSQL linked against libxml (on OS X) #135

Open wjv opened 8 years ago

wjv commented 8 years ago

If I try to build and install Multicorn for a PostgreSQL that has been built against libxml (i.e. using the --with-libxml flag to configure), it fails to work. Any attempt to access Multicorn (e.g. a CREATE EXTENSION statement) results in this error:

ERROR:  could not load library "/usr/local/pgsql/lib/multicorn.so": dlopen(/usr/local/pgsql/lib/multicorn.so, 10): Symbol not found: _PyUnicodeUCS4_AsUnicode
  Referenced from: /usr/local/pgsql/lib/multicorn.so
  Expected in: flat namespace
 in /usr/local/pgsql/lib/multicorn.so

This happens irrespective of whether I install Multicorn using pgxn, or build it from source.

If I examine the multicorn.so shared library file with nm, I notice that many symbols are undefined. The shared library file is also small (~52KB).

If I build Multicorn against a PostgreSQL that has not been built against libxml, the resulting multicorn.so is about 1.9MB and contains vastly more symbols.

Right now the only workaround is to build Postgres without libxml, then install Multicorn, then build Postgres again including libxml support and reinstall it.

Details of system:

Please let me know if I can supply any further details.

wjv commented 8 years ago

Upon further investigation, this appears to be so closely linked to a problem with PostgreSQL itself that it is probably not an issue specific to Multicorn.

If one compiles Postgres with both --with-libxml and --with-python on the system as described above, the plpythonu.so shared library is not built correctly. I’m still trying to get a grip on the exact nature of the bug so that I may submit it to the PostgreSQL project.

jmealo commented 8 years ago

@wjv: Any updates? I'm trying to see if we can get a PR together to fix any outstanding issues with OSX.

wjv commented 8 years ago

@jmealo No updates, save to say that the bug still exists in PostgreSQL 9.5.3 on OS X 10.11.5.

I’ve simply not had the time to try to characterise the issue properly so that I could submit a bug report. Instead, I’ve simply been working around it: Every time I wish to install/upgrade Postgres on OS X, I jump through these hoops…