Sphinx 2.0.4 MAMP 2.0安装错误:无法找到MySQL标题 [英] Sphinx 2.0.4 Install Error with MAMP 2.0: Can't Find MySQL Headers

查看:217
本文介绍了Sphinx 2.0.4 MAMP 2.0安装错误:无法找到MySQL标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MAMP本地开发,需要Sphinx与MAMP的MySQL一起工作。基本上在 $ sudo make 中安装了一个死胡同。



MAMP安装时没有为Sphinx集成提供一些必要资源,主要是mysql lib目录和一个包含C头文件的include目录。这些被成功下载并安装(使用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 

我得到了:

  *********** ************************************************** ***************** 
错误:找不到MySQL包含文件。

检查您是否安装了MySQL包含文件。
软件包名称通常是'mysql-devel'。

如果您的系统上安装了包含文件,但您仍然收到
此消息,则应执行以下操作之一:

1)或者指定includes明确的位置,使用--with-mysql-includes;
2)或者使用--with-mysql明确指定MySQL安装根目录位置;
3),或者确保'mysql_config'程序的路径在

中列出./configure命令:

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

在一开始就会抛出以下内容,但不管结果是否成功:

  configure:警告:你应该使用--build,--host,--target 
configure:警告:无效的主机类型:/ Applications / MAMP / Library / include
configure:警告:你应该使用--build ,--host,--target
configure:警告:无效主机类型:/ Applications / MAMP / Library / lib

日志还有以下行,(我认为这在一秒内是相关的):

 检查MySQL包含文件... -Iyes 

现在,继续, $ sudo make 会引发以下操作:

  $ b / 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
在sphinx.cpp包含的文件中:16:
sphinx.h:64:19:error:mysql.h:没有这样的文件或目录

... //由于上面的

产生了一大堆错误,所以我知道mysql。 h存在于我的包含文件中,我想我也有所有必要的二进制文件,并且配置似乎看到包含文件,所以我正在撕掉我的头发。我希望这是一个简单的路径问题,或者是与./configure属性有关的语法错误,因为这是我第一次从命令行编译和安装。



谢谢。

解决方案

Sphinx的 ./ configure 缺省值为 - with-mysql ,默认情况下已启用,这可能会让您认为调用它不是必需的。

要使Sphinx与MAMP的各种分布式MySQL文件一起工作,请确保在 ./ configure 中使用以下每个属性c $ c>命令,为每个命令指定直接路径:

   -  with-mysql = // root mysql app 
--with-includes = //到mysql头文件的路径包括
--with-mysql-libs = // libmysqlclient.dylib文件的路径

最后一条为我工作的命令:

  ./ 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的扩展干扰功能(如果您下载了它)。



如果这样运行没有错误,只需 make make install 你很好走。



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


Developing locally in MAMP and need Sphinx to work with MAMP's MySQL. Basically hitting a dead end during $ sudo make.

MAMP installs without some necessary resources for Sphinx integration, mainly a mysql lib directory and an include directory filled with C header source files. These were downloaded and installed successfully (using CMake) into the following directories:

/Applications/MAMP/Library/include/mysql
/Applications/MAMP/Library/lib/mysql

After unzipping Sphinx and running:

sudo ./configure --prefix=/usr/local/sphinx --with-libstemmer --with-mysql=/Applications/MAMP/Library

I got:

******************************************************************************
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

Changing the ./configure command to:

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

throws the following on the outset, but regardless results in a successful configuration:

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

The log also has the following line, (which I think is relevant in a sec):

checking MySQL include files... -Iyes

Now, continuing, $ sudo make throws the following:

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

So, I know mysql.h exists in my includes file, I think I have all necessary binaries as well, and the configuration seems to see the include files so I'm tearing out my hair a bit. I'm hoping this is a simple path problem, or a syntax error on my part with the ./configure attribute since this is my first time compiling and installing from the command line.

Thanks.

解决方案

Sphinx's ./configure uses an unknown default value for --with-mysql, which is enabled by default, which could make you think calling it is not necessary.

To get Sphinx to work with MAMP's varyingly distributed MySQL files, make sure to use each of the following attributes in your ./configure command, specifying direct paths for each:

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

The final command that worked for me:

./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 is your preferred install directory in usr/local and --libstemmer adds Snowball's extended stemming functionality (if you downloaded it).

If this runs without error, just make and make install and you're good to go.

Also note that there's a configure error log in the uncompressed Sphinx directory that's easy to overlook. Didn't help in this scenario, but could be really useful to others if you're having problems.

这篇关于Sphinx 2.0.4 MAMP 2.0安装错误:无法找到MySQL标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆