Segfault-Inc / Multicorn

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

Link errors on OS X with PostgreSQL 9.4 #88

Closed rtkrruvinskiy closed 9 years ago

rtkrruvinskiy commented 9 years ago

When trying to install on OS X with PostgreSQL 9.4 (tried both http://postgresapp.com and http://www.enterprisedb.com/products-services-training/pgdownload), I get a wall of link errors. I'm assuming I'm missing a library, but I can't figure out what library that is.

gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv  -bundle -multiply_defined suppress -o multicorn.so src/errors.o src/python.o src/query.o src/multicorn.o -L/Applications/Postgres.app/Contents/Versions/9.4/lib -L/Applications/Postgres.app/Contents/Versions/9.4/lib  -L/Applications/Postgres.app/Contents/Versions/9.4/lib -Wl,-dead_strip_dylibs   -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -ldl -framework CoreFoundation -lpython2.7 -ldl  -framework CoreFoundation
Undefined symbols for architecture x86_64:
  "_AllocSetContextCreate", referenced from:
      _getCacheEntry in python.o
  "_CacheMemoryContext", referenced from:
      _getCacheEntry in python.o
      __PG_init in multicorn.o
  "_CurrentMemoryContext", referenced from:
      _getCacheEntry in python.o
      _MemoryContextSwitchTo in python.o
      _canonicalScalarArrayOpExpr in query.o
      _findPaths in query.o
      _MemoryContextSwitchTo in multicorn.o
      _multicorn_handler in multicorn.o
  "_DirectFunctionCall1Coll", referenced from:
      _datumNumberToPython in python.o
      _datumDateToPython in python.o
....
rdunklau commented 9 years ago

Do you have the PostgreSQL server header files ? It doesn't seem to be included in your gcc command line. Which version of Multicorn are you using ?

rtkrruvinskiy commented 9 years ago

Yes, I believe I have the header files, since I'm getting link errors rather than compilation errors. I only posted the gcc link line. It is preceded by successful object file compilations:

gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv  -I. -I./ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I./ -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/9.4/include/libxml2  -I/Applications/Postgres.app/Contents/Versions/9.4/include  -c -o src/errors.o src/errors.c
gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv  -I. -I./ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I./ -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/9.4/include/libxml2  -I/Applications/Postgres.app/Contents/Versions/9.4/include  -c -o src/python.o src/python.c
gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv  -I. -I./ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I./ -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/9.4/include/libxml2  -I/Applications/Postgres.app/Contents/Versions/9.4/include  -c -o src/query.o src/query.c
gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv  -I. -I./ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I./ -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/9.4/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/9.4/include/libxml2  -I/Applications/Postgres.app/Contents/Versions/9.4/include  -c -o src/multicorn.o src/multicorn.c

I've tried using pgxn to install Multicore (1.1.0) as well as getting the latest from git. Same result.

It just occurred to me, are these symbols only expected to be resolved at runtime rather than link time?

rtkrruvinskiy commented 9 years ago

Turns out the issue here is with the link flags PGXS uses on OS X.