代码之家  ›  专栏  ›  技术社区  ›  Charlie Egan balanv

无法在OSX上安装summarygem,缺少glib.h

  •  0
  • Charlie Egan balanv  · 技术社区  · 10 年前

    我想安装这个宝石, 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 回复  |  直到 10 年前
        1
  •  1
  •   Nathan Kot    10 年前

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

        2
  •  1
  •   mcfinnigan    10 年前

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