amutu / zhparser

zhparser is a PostgreSQL extension for full-text search of Chinese language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mac osx 编译报错

huzhengyao opened this issue · comments

mac osx 版本:10.12.1
postgresql 版本:10.1.3
步骤:
下载:http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2
./configure --with-pic
sudo make install

下载:https://github.com/amutu/zhparser
sudo gmake
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.8 -arch i386 -arch x86_64 -O2 -bundle -multiply_defined suppress -o zhparser.so zhparser.o -L/mizi/pgsql-10.1.3/lib -L/opt/local/Current/lib -L/opt/local/20151229/lib -Wl,-dead_strip_dylibs -lscws -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -bundle_loader /mizi/pgsql-10.1.3/bin/postgres
ld: warning: directory not found for option '-L/opt/local/Current/lib'
ld: warning: directory not found for option '-L/opt/local/20151229/lib'
ld: warning: ignoring file /usr/local/lib/libscws.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libscws.dylib
Undefined symbols for architecture i386:
"_scws_add_dict", referenced from:
_zhprs_start in zhparser.o
"_scws_free", referenced from:
_zhprs_start in zhparser.o
"_scws_free_result", referenced from:
_zhprs_getlexeme in zhparser.o
"_scws_get_result", referenced from:
_zhprs_start in zhparser.o
_zhprs_getlexeme in zhparser.o
"_scws_new", referenced from:
_zhprs_start in zhparser.o
"_scws_send_text", referenced from:
_zhprs_start in zhparser.o
"_scws_set_charset", referenced from:
_zhprs_start in zhparser.o
"_scws_set_dict", referenced from:
_zhprs_start in zhparser.o
"_scws_set_duality", referenced from:
_zhprs_start in zhparser.o
"_scws_set_ignore", referenced from:
_zhprs_start in zhparser.o
"_scws_set_multi", referenced from:
_zhprs_start in zhparser.o
"_scws_set_rule", referenced from:
_zhprs_start in zhparser.o
ld: symbol(s) not found for architecture i386

commented

从错误信息上看,好像你混用了64位和32位的程序和库。确保你的pg,scws,zhparser都编译为32位或者64位。

解决了,官方下载的pg二进制的还是不靠谱,CFLAGS目测无法修改,换成brew install PostgreSQL不报错

二进制安装:
juhua002deMini:zhparser-master juhua002$ /mizi/pgsql-10.1.3/bin/pg_config
BINDIR = /mizi/pgsql-10.1.3/bin
DOCDIR = /mizi/pgsql-10.1.3/doc/postgresql
HTMLDIR = /mizi/pgsql-10.1.3/doc/postgresql
INCLUDEDIR = /mizi/pgsql-10.1.3/include
PKGINCLUDEDIR = /mizi/pgsql-10.1.3/include/postgresql
INCLUDEDIR-SERVER = /mizi/pgsql-10.1.3/include/postgresql/server
LIBDIR = /mizi/pgsql-10.1.3/lib
PKGLIBDIR = /mizi/pgsql-10.1.3/lib/postgresql
LOCALEDIR = /mizi/pgsql-10.1.3/share/locale
MANDIR = /mizi/pgsql-10.1.3/share/man
SHAREDIR = /mizi/pgsql-10.1.3/share/postgresql
SYSCONFDIR = /mizi/pgsql-10.1.3/etc/postgresql
PGXS = /mizi/pgsql-10.1.3/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--with-icu' '--prefix=/mnt/hgfs/pginstaller.auto/server/staging_cache/osx.build' '--with-ldap' '--with-openssl' '--with-perl' '--with-python' '--with-tcl' '--with-bonjour' '--with-pam' '--enable-thread-safety' '--with-libxml' '--with-uuid=e2fs' '--with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security' '--docdir=/mnt/hgfs/pginstaller.auto/server/staging_cache/osx.build/doc/postgresql' '--with-libxslt' '--with-libedit-preferred' '--with-gssapi' 'CFLAGS=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.8 -arch i386 -arch x86_64 -O2' 'LDFLAGS=-L/opt/local/Current/lib' 'ICU_CFLAGS=-I/opt/local/Current/include' 'ICU_LIBS=-L/opt/local/Current/lib -licuuc -licudata -licui18n'
CC = gcc
CPPFLAGS = -DFRONTEND -I/opt/local/Current/include -I/opt/local/20151229/include/libxml2 -I/opt/local/Current/include/libxml2 -I/opt/local/Current/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.8 -arch i386 -arch x86_64 -O2
CFLAGS_SL =
LDFLAGS = -L../../src/common -L/opt/local/Current/lib -L/opt/local/20151229/lib -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lm
VERSION = PostgreSQL 10.1

brew install安装:
juhua002deMini:zhparser-master juhua002$ /usr/local/bin/pg_config
BINDIR = /usr/local/Cellar/postgresql/10.1/bin
DOCDIR = /usr/local/Cellar/postgresql/10.1/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/10.1/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/10.1/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/10.1/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/10.1/include/server
LIBDIR = /usr/local/lib
PKGLIBDIR = /usr/local/lib/postgresql
LOCALEDIR = /usr/local/Cellar/postgresql/10.1/share/locale
MANDIR = /usr/local/Cellar/postgresql/10.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/10.1' '--datadir=/usr/local/share/postgresql' '--libdir=/usr/local/lib' '--sysconfdir=/usr/local/etc' '--docdir=/usr/local/Cellar/postgresql/10.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.13.sdk/System/Library/Frameworks/Tcl.framework' '--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' 'PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.12'
CC = clang
CPPFLAGS = -DFRONTEND -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.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 -Wl,-dead_strip_dylibs
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm
VERSION = PostgreSQL 10.1