Ruby Can';t在OSX上安装摘要gem,缺少glib.h

Ruby Can';t在OSX上安装摘要gem,缺少glib.h,ruby,macos,gem,homebrew,glib,Ruby,Macos,Gem,Homebrew,Glib,我正在尝试通过运行以下命令安装此gem: 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 in

我正在尝试通过运行以下命令安装此gem:

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:致命错误:“未找到libxml/xmlmemory.h”文件
#包括

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

我遇到了完全相同的问题,我建议改用这个gem:它提供OSX指令,并为我无缝地安装在Mavericks上。

我已经为我的问题添加了一个更新,如何安装glib revel
brew install glib2-devel
似乎找不到任何内容。您似乎也需要libxml-devel。安装这些的命令是什么?brew似乎找不到这些名称的任何内容
brew install glib
将安装正确的库并添加为符号链接(请参阅):
sudo ln-s/usr/local/opt/libxml2/include/libxml2/libxml/usr/local/include/libxml
,这就是我最终使用的。据我所知,它的作用大致相同。干杯
dictionary.c:28:10: fatal error: 'libxml/xmlmemory.h' file not found
#include <libxml/xmlmemory.h>