尝试使用Homebrew在Mac OSX上编译Gearman时,出现以下错误:
brew install gearman --with-mysql
libtool: compile: clang++ -DHAVE_CONFIG_H -I. -fvisibility=hidden -I/usr/include -D_THREAD_SAFE -DBUILDING_LIBGEARMAN -DHAVE_HTONLL -std=c++0x -g -O2 -Wno-unknown-pragmas -Qunused-arguments -Wall -Wextra -Wno-attributes -Wvarargs -Waddress -Warray-bounds -Wchar-subscripts -Wcomment -Wctor-dtor-privacy -Wfloat-equal -Wformat=2 -Wformat-y2k -Wmissing-field-initializers -Wnon-virtual-dtor -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wc++11-compat -Wunused -Wunused-result -Wunused-variable -Wunused-parameter -Wwrite-strings -Wformat-security -fwrapv -pipe -Wsizeof-pointer-memaccess -Wpacked -c libgearman-server/plugins/queue/mysql/queue.cc -fno-common -DPIC -o libgearman-server/plugins/queue/mysql/.libs/libgearman_server_libgearman_server_la-queue.o
libgearman-server/plugins/queue/mysql/queue.cc:49:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
^
1 error generated
我使用的是MariaDB而不是MySQL - 我怀疑这可能是原因。
答案 0 :(得分:0)
快速简便的解决方法:
brew edit gearman
寻找这一行:
args << (build.with?("mysql") ? "--with-mysql=#{Formula["mysql"].opt_bin}/mysql_config" : "--without-mysql")
将Formula["mysql"]
更改为Formula["mariadb"]
再次运行brew install gearman --with-mysql
,它将成功编译。