无法在OSX上安装总结gem,缺少glib.h

时间:2014-03-26 10:46:05

标签: ruby macos gem homebrew glib

我试图通过运行:

来安装此gem summarize
gem install summarise

我收到错误:

ERROR: Failed to build gem native extension.
...
In file included from article.c:25:
./libots.h:24:10: fatal error: 'glib.h' file not found

但是当我试着跑步时:

brew install glib

我得到:

glib-2.38.2 already installed

关于下一步尝试的任何想法?


编辑: 我试过了以后:

export CPPFLAGS=-I/usr/local/Cellar/glib/2.38.2/include/glib-2.0/
export LDFLAGS=-L/usr/local/Cellar/glib/2.38.2/lib/
export PKG_CONFIG_PATH=/usr/local/Cellar/glib/2.38.2/lib/pkgconfig/

......这似乎让我继续犯了一个新的错误:

compiling article.c
article.c:107:37: warning: passing 'const unsigned char *' to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
if ((aWord == NULL) || (0==strlen(aWord)) ||(NULL==aLine)) return;
                                ^~~~~
/usr/include/string.h:82:28: note: passing argument to parameter here
size_t   strlen(const char *);
                        ^
article.c:109:68: warning: passing 'const unsigned char *' to parameter of type 'const gchar *' (aka 'const char *') converts between pointers to integer types with different sign [-Wpointer-sign]
aLine->words = g_list_append (aLine->words, (gpointer) g_strdup (aWord));
                                                               ^~~~~
/usr/local/Cellar/glib/2.38.2/include/glib-2.0/glib/gstrfuncs.h:216:52: note: passing argument to parameter 'str' here
gchar*                g_strdup         (const char *str) G_GNUC_MALLOC;

...

dictionary.c:28:10: fatal error: 'libxml/xmlmemory.h' file not found
#include <libxml/xmlmemory.h>

2 个答案:

答案 0 :(得分:1)

您可能需要安装glib-devel,它将包含glib库的源代码和标头。

答案 1 :(得分:1)

我遇到了完全相同的问题,我建议使用这个gem:https://github.com/deepfryed/ots提供OSX指令,并为我无缝地安装在Mavericks上。