Segfault-Inc / Multicorn

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

Build fails with clang on OSX 10.11 with PostgreSQL 9.5.1 and Python 2.7 #139

Closed jmealo closed 5 years ago

jmealo commented 8 years ago

I get this error when building from source or using the pgxn installer:

clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2  -bundle -multiply_defined suppress -Wl,-undefined,dynamic_lookup -o multicorn.so src/errors.o src/python.o src/query.o src/multicorn.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib  -Wl,-dead_strip_dylibs  -undefined dynamic_lookup -bundle_loader /usr/local/Cellar/postgresql/9.5.1/bin/postgres  -bundle_loader /usr/local/Cellar/postgresql/9.5.1/bin/postgres -lpython2.7 -ldl -framework CoreFoundation -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -ldl -framework CoreFoundation  
0  0x10f29497e  __assert_rtn + 144
1  0x10f2fa260  ld::tool::OutputFile::compressedOrdinalForAtom(ld::Atom const*) + 246
2  0x10f2faf29  ld::tool::OutputFile::addDyldInfo(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) + 2253
3  0x10f2f079a  ld::tool::OutputFile::generateLinkEditInfo(ld::Internal&) + 1278
4  0x10f2ebe56  ld::tool::OutputFile::write(ld::Internal&) + 116
5  0x10f2958fa  main + 1311
A linker snapshot was created at:
    /tmp/multicorn.so-2016-03-13-090505.ld-snapshot
ld: Assertion failed: (0 && "dylib not assigned ordinal"), function compressedOrdinalForAtom, file /Library/Caches/com.apple.xbs/Sources/ld64/ld64-264.3.101/src/ld/OutputFile.cpp, line 3552.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [multicorn.so] Error 1

pg_config output:

BINDIR = /usr/local/Cellar/postgresql/9.5.1/bin
DOCDIR = /usr/local/Cellar/postgresql/9.5.1/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/9.5.1/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/9.5.1/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/9.5.1/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/9.5.1/include/server
LIBDIR = /usr/local/lib
PKGLIBDIR = /usr/local/lib/postgresql
LOCALEDIR = /usr/local/Cellar/postgresql/9.5.1/share/locale
MANDIR = /usr/local/Cellar/postgresql/9.5.1/share/man
SHAREDIR = /usr/local/share/postgresql
SYSCONFDIR = /usr/local/etc/postgresql
PGXS = /usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--disable-debug' '--prefix=/usr/local/Cellar/postgresql/9.5.1' '--datadir=/usr/local/share/postgresql' '--libdir=/usr/local/lib' '--sysconfdir=/usr/local/etc' '--docdir=/usr/local/Cellar/postgresql/9.5.1/share/doc/postgresql' '--enable-thread-safety' '--with-bonjour' '--with-gssapi' '--with-ldap' '--with-openssl' '--with-pam' '--with-libxml' '--with-libxslt' '--with-perl' '--with-tcl' '--with-tclconfig=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib' '--with-uuid=e2fs' 'CC=clang' 'LDFLAGS=-L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' 'CPPFLAGS=-I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include'
CC = clang
CPPFLAGS = -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2
CFLAGS_SL = 
LDFLAGS = -L../../../src/common -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm 
VERSION = PostgreSQL 9.5.1
robconrad commented 8 years ago

+1

ramanbuttar commented 8 years ago

bump. running into same issue

rotten commented 8 years ago

YMMV, however, I went into the makefile and changed the line (93) that said:

ifeq ($(PORTNAME),darwin) to ifeq ($(PORTNAME),Darwin)

And then Multicorn built.

ergo70 commented 8 years ago

I can confirm that

ifeq ($(PORTNAME),darwin) to ifeq ($(PORTNAME),Darwin)

fixes the build.

jmealo commented 8 years ago

@ergo70 @rotten: Kudos, great work! Would you like to make a PR or should someone else?

I tested this and the build also worked. I did not thoroughly test Multicorn though.

ergo70 commented 8 years ago

I also found that I need to install the multicorn python module with:

sudo ARCHFLAGS="-arch x86_64" python setup.py install

Otherwise clang tries to build a 32 & 64 bit version and that fails, because int128 is not supported for 32 bit targets.

thoughtchad commented 7 years ago
  1. edit makefile, change darwin to Darwin
  2. make
  3. sudo ARCHFLAGS="-arch x86_64" make install
niweicumt commented 7 years ago

edit Makefile, line (93), change darwin to Darwin make sudo ARCHFLAGS="-arch x86_64" make install

ghost commented 6 years ago

Please merge https://github.com/Kozea/Multicorn/pull/197