使用MAMP 2.0的Sphinx 2.0.4安装错误:无法找到MySQL标头

时间:2012-05-13 06:55:36

标签: mysql gcc sphinx mamp

在MAMP本地开发并需要Sphinx与MAMP的MySQL一起工作。在$ sudo make期间基本上达到了死胡同。

MAMP安装没有一些必要的资源用于Sphinx集成,主要是一个mysql lib目录和一个填充了C头文件源文件的include目录。这些已成功下载并安装(使用CMake)到以下目录:

/应用/ MAMP /库/包括/ MySQL的
/应用/ MAMP /库/ 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属性的语法错误,因为这是我第一次从命令行编译和安装。

感谢。

1 个答案:

答案 0 :(得分:1)

Sphinx的./configure使用--with-mysql的未知默认值,默认情况下已启用,这可能会让您认为无需调用它。

要让Sphinx使用MAMP不同分布的MySQL文件,请确保在./configure命令中使用以下每个属性,为每个属性指定直接路径:

--with-mysql= // root mysql app
--with-includes= // path to mysql header includes
--with-mysql-libs= // path to libmysqlclient.dylib files

对我有用的最终命令:

./configure --prefix=/usr/local/sphinx --with-libstemmer --with-mysql=/Applications/MAMP/Library --with-mysql-includes=/Applications/MAMP/Library/include/mysql --with-mysql-libs=/Applications/MAMP/Library/lib/mysql

--prefix是usr / local中首选的安装目录,--libstemmer添加了Snowball的扩展词干功能(如果您下载了它)。

如果此操作没有错误,只需makemake install,您就可以开始了。

另请注意,在未压缩的Sphinx目录中存在一个容易忽略的配置错误日志。在这种情况下没有帮助,但如果您遇到问题,可能对其他人非常有用。