![OSX 上的 Sphinx - 在 OSX 上构建](https://linux22.com/image/528190/OSX%20%E4%B8%8A%E7%9A%84%20Sphinx%20-%20%E5%9C%A8%20OSX%20%E4%B8%8A%E6%9E%84%E5%BB%BA.png)
有人能告诉我为什么 sphinx 可能无法安装在我的 Snow Leopard OSX 机器上吗?
我目前已启动并运行(从非 MAMP 安装);Apache、MySQL、PHP。
运行时./configure --with-mysql=/usr/local/mysql --without-unixodbc
(建议让它工作)我得到:
enter code here
checking build environment
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for compiler programs
checking whether to compile debug version... no
checking for gcc... gcc
checking for C compiler default output file name... rm: a.out.dSYM: is a directory
a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for header files
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking expat.h usability... yes
checking expat.h presence... yes
checking for expat.h... yes
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking sql.h usability... yes
checking sql.h presence... yes
checking for sql.h... yes
checking for types
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for library functions
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for sys/socket.h... (cached) yes
checking types of arguments for select... int,fd_set *,struct timeval *
rm: conftest.dSYM: is a directory
checking return type of signal handlers... void
checking whether lstat dereferences a symlink specified with a trailing slash... no
checking whether stat accepts an empty string... no
checking for vprintf... yes
checking for _doprnt... no
checking for library containing setsockopt... none required
checking for library containing gethostbyname... none required
checking for library containing XML_Parse... -lexpat
checking for library containing iconv... -liconv
checking for library containing inflate... -lz
checking for library containing logf... none required
checking for library containing SQLConnect... -lodbc
checking for dup2... yes
checking for gethostbyname... yes
checking for gettimeofday... yes
checking for memmove... yes
checking for memset... yes
checking for select... yes
checking for socket... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strstr... yes
checking for strtol... yes
checking for logf... yes
checking for pread... yes
checking for clock_gettime in -lrt... no
checking for clock_gettime... no
checking for LOCK_EX in sys/file.h... rm: conftest.dSYM: is a directory
yes
checking for F_SETLKW in fcntl.h... rm: conftest.dSYM: is a directory
yes
configuring Sphinx
checking for CFLAGS needed for pthreads... none
checking for LIBS needed for pthreads... -lpthread
checking for pthreads... found
checking whether to compile with MySQL support... yes
checking for mysql_config... /usr/local/mysql/bin/mysql_config
checking for mysql_real_connect... yes
checking MySQL include files... -I/usr/local/mysql/include -g -Os -arch i386 -fno- common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ - DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
checking MySQL libraries... -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lmygcc
checking whether to compile with PostgreSQL support... no
checking whether to use 64-bit document/word IDs... no
checking whether to compile with libstemmer support... no
checking for libexpat... found
checking for libiconv... found
checking for iconv() arg types... char **
checking for UnixODBC... disabled
checking for unaligned RAM access... yes
generating configuration files
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating libstemmer_c/Makefile
config.status: creating sphinx.conf.dist
config.status: creating sphinx-min.conf.dist
config.status: creating config/config.h
config.status: executing depfiles commands
configuration done
You can now run 'make' to build Sphinx binaries,
and then run 'make install' to install them.
但是当我运行时make
我得到了这个:
Making all in src
if test -d ../.svn; then svn info .. --xml | perl svnxrev.pl; fi;
make all-am
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinx.o -MD -MP -MF .deps/sphinx.Tpo -c -o sphinx.o sphinx.cpp
sphinx.cpp: In member function ‘virtual void CSphIndex_VLN::DebugDumpDocids(FILE*)’:
sphinx.cpp:14647: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long unsigned int’
mv -f .deps/sphinx.Tpo .deps/sphinx.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxexcerpt.o -MD -MP -MF .deps/sphinxexcerpt.Tpo -c -o sphinxexcerpt.o sphinxexcerpt.cpp
mv -f .deps/sphinxexcerpt.Tpo .deps/sphinxexcerpt.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxquery.o -MD -MP -MF .deps/sphinxquery.Tpo -c -o sphinxquery.o sphinxquery.cpp
mv -f .deps/sphinxquery.Tpo .deps/sphinxquery.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxsoundex.o -MD -MP -MF .deps/sphinxsoundex.Tpo -c -o sphinxsoundex.o sphinxsoundex.cpp
mv -f .deps/sphinxsoundex.Tpo .deps/sphinxsoundex.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxmetaphone.o -MD -MP -MF .deps/sphinxmetaphone.Tpo -c -o sphinxmetaphone.o sphinxmetaphone.cpp
mv -f .deps/sphinxmetaphone.Tpo .deps/sphinxmetaphone.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxstemen.o -MD -MP -MF .deps/sphinxstemen.Tpo -c -o sphinxstemen.o sphinxstemen.cpp
mv -f .deps/sphinxstemen.Tpo .deps/sphinxstemen.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxstemru.o -MD -MP -MF .deps/sphinxstemru.Tpo -c -o sphinxstemru.o sphinxstemru.cpp
mv -f .deps/sphinxstemru.Tpo .deps/sphinxstemru.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxstemcz.o -MD -MP -MF .deps/sphinxstemcz.Tpo -c -o sphinxstemcz.o sphinxstemcz.cpp
mv -f .deps/sphinxstemcz.Tpo .deps/sphinxstemcz.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxutils.o -MD -MP -MF .deps/sphinxutils.Tpo -c -o sphinxutils.o sphinxutils.cpp
mv -f .deps/sphinxutils.Tpo .deps/sphinxutils.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxstd.o -MD -MP -MF .deps/sphinxstd.Tpo -c -o sphinxstd.o sphinxstd.cpp
mv -f .deps/sphinxstd.Tpo .deps/sphinxstd.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxsort.o -MD -MP -MF .deps/sphinxsort.Tpo -c -o sphinxsort.o sphinxsort.cpp
mv -f .deps/sphinxsort.Tpo .deps/sphinxsort.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxexpr.o -MD -MP -MF .deps/sphinxexpr.Tpo -c -o sphinxexpr.o sphinxexpr.cpp
mv -f .deps/sphinxexpr.Tpo .deps/sphinxexpr.Po
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxfilter.o -MD -MP -MF .deps/sphinxfilter.Tpo -c -o sphinxfilter.o sphinxfilter.cpp
mv -f .deps/sphinxfilter.Tpo .deps/sphinxfilter.Po
rm -f libsphinx.a
ar cru libsphinx.a sphinx.o sphinxexcerpt.o sphinxquery.o sphinxsoundex.o sphinxmetaphone.o sphinxstemen.o sphinxstemru.o sphinxstemcz.o sphinxutils.o md5.o sphinxstd.o sphinxsort.o sphinxexpr.o sphinxfilter.o
ranlib libsphinx.a
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/etc\"" -I/usr/local/include -I/usr/local/mysql/include -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT indexer.o -MD -MP -MF .deps/indexer.Tpo -c -o indexer.o indexer.cpp
mv -f .deps/indexer.Tpo .deps/indexer.Po
g++ -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -o indexer indexer.o libsphinx.a -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lmygcc -lodbc -lz -liconv -lexpat -L/usr/local/lib -lpthread
ld: warning: directory '/usr/local/lib' following -L not found
ld: warning: in indexer.o, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in libsphinx.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /usr/local/mysql/lib/libmygcc.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [indexer] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
答案1
设置LDFLAGS
为
'-arch i386'
修复了我在 Mac OSX 10.6.4 上的问题