在 MAMP 本地开发,需要 Sphinx 与 MAMP 的 MySQL 一起工作。期间基本陷入死胡同$ sudo make
。
MAMP 安装时没有一些用于 Sphinx 集成的必要资源,主要是一个 mysql lib 目录和一个包含 C 头源文件的包含目录。这些已成功下载并安装(使用 CMake)到以下目录中:
/Applications/MAMP/Library/include/mysql
/Applications/MAMP/Library/lib/mysql
解压 Sphinx 并运行后:
sudo ./configure --prefix=/usr/local/sphinx --with-libstemmer --with-mysql=/Applications/MAMP/Library
我有:
******************************************************************************
ERROR: cannot find MySQL include files.
Check that you do have MySQL include files installed.
The package name is typically 'mysql-devel'.
If include files are installed on your system, but you are still getting
this message, you should do one of the following:
1) either specify includes location explicitly, using --with-mysql-includes;
2) or specify MySQL installation root location explicitly, using --with-mysql;
3) or make sure that the path to 'mysql_config' program is listed in
将 ./configure 命令更改为:
sudo ./configure --prefix=/usr/local/sphinx--with-libstemmer --with-mysql-includes /Applications/MAMP/Library/include --with-mysql-libs /Applications/MAMP/Library/lib
一开始就抛出以下内容,但无论如何都会导致配置成功:
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: /Applications/MAMP/Library/include
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: /Applications/MAMP/Library/lib
该日志还具有以下行(我认为这是相关的):
checking MySQL include files... -Iyes
现在,继续,$ sudo make
抛出以下内容:
Making all in src
/bin/sh svnxrev.sh ..
make all-am
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/usr/local/sphinx--with-libstemmer/etc\"" -DDATADIR="\"/usr/local/sphinx--with-libstemmer/var/data\"" -I/usr/local/include -Iyes -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinx.o -MD -MP -MF .deps/sphinx.Tpo -c -o sphinx.o sphinx.cpp
In file included from sphinx.cpp:16:
sphinx.h:64:19: error: mysql.h: No such file or directory
... //whole bunch of errors follow, resulting from the above
所以,我知道 mysql.h 存在于我的包含文件中,我想我也有所有必要的二进制文件,并且配置似乎看到了包含文件,所以我有点担心。我希望这是一个简单的路径问题,或者是我的 ./configure 属性的语法错误,因为这是我第一次从命令行编译和安装。
谢谢。