macos – 当我尝试编译其他应用程序时,找不到与Brew一起安装的GTK

我用brew install gtk安装了GTK,因为我需要它来从Mac上的源代码编译xchat.当我尝试安装它很难,它说无法找到GTK!没有构建GTK FrontEnd.

 我怀疑我应该在安装gtk后更新环境变量,但我不知道如何.

iMac:xchat-2.8.8 Domenico$brew info gtk+
gtk+: stable 2.24.20
http://gtk.org/
/usr/local/Cellar/gtk+/2.24.20 (1184 files, 52M) * // here is the path!!!
  Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/gtk+.rb
==> Dependencies
Build: pkg-config, xz
Required: glib, jpeg, libtiff, gdk-pixbuf, pango, atk, cairo
Optional: jasper
==> Options
--with-jasper
    Build with jasper support

该路径列在上面的代码中.我尝试添加与它相关的所有类型的东西(例如/usr/local/Cellar / gtk /2.24.20/bin或/usr/local/Cellar)到$LD_LIBRARY_PATH但是它不起作用.有任何想法吗?

最佳答案 brew安装gtk之后我遇到了一些熟悉的问题.具体来说,我得到了:

    Package xcb-shm was not found in the pkg-config search path.
    Perhaps you should add the directory containing `xcb-shm.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'xcb-shm', required by 'cairo', not found
    app.c:1:10: fatal error: 'gtk/gtk.h' file not found
    #include <gtk/gtk.h>
             ^
    1 error generated.
    make: *** [app] Error 1

在为我的应用程序运行make时,这个命令解决了我的问题:

export PKG_CONFIG_PATH = / opt / X11 / lib / pkgconfig

关于这个问题的扩展答案已在这里得到解答:https://stackoverflow.com/a/23988317/4694621.

这可能是一个问题,因为gtk依赖于这些库(source):

Glib
Pango
ATK
GDK
GdkPixbuf
Cairo
点赞