简体   繁体   English

在pkg-config搜索路径中找不到包cairo

[英]Package cairo was not found in the pkg-config search path

On Mac OS X 1.7.5 / Lion 在Mac OS X 1.7.5 / Lion上

I am trying to install cairo package using homebrew 我正在尝试使用自制软件安装cairo包

brew install cairo => PASSED

==> Downloading http://cairographics.org/releases/cairo-1.12.16.tar.xz
Already downloaded: /Library/Caches/Homebrew/cairo-1.12.16.tar.xz
==> ./configure --prefix=/usr/local/Cellar/cairo/1.12.16 --with-x --enable-gobject=yes
==> make install
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software in versions before Mountain Lion.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/cairo/lib
    CPPFLAGS: -I/usr/local/opt/cairo/include

==> Summary
🍺  /usr/local/Cellar/cairo/1.12.16: 105 files, 8.0M, built in 2.5 minutes

When I try to compile my code I still get this: 当我尝试编译我的代码时,我仍然得到这个:

+++ Precompile
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'cairo', required by 'pangocairo', not found

So I adjusted my PKG_CONFIG_PATH accordingly 所以我相应地调整了我的PKG_CONFIG_PATH

 PKG_CONFIG_PATH=/usr/local/opt/cairo/lib/pkgconfig/:/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig/:

(source .bash_profile) (来源.bash_profile)

Tried to compile again, but I get the exact same error. 试图再次编译,但我得到完全相同的错误。

Verified that the file was present in that pkgconfig directory ... it is. 验证该文件存在于该pkgconfig目录中......它是。

ls /usr/local/opt/cairo/lib/pkgconfig/ 
cairo-fc.pc           cairo-gobject.pc      cairo-png.pc          cairo-quartz-font.pc  cairo-script.pc       cairo-xcb-shm.pc      cairo-xlib-xrender.pc cairo.pc
cairo-ft.pc           cairo-pdf.pc          cairo-ps.pc           cairo-quartz.pc       cairo-svg.pc          cairo-xcb.pc          cairo-xlib.pc

Any leads on what is going wrong here? 这里出了什么问题导致什么?

UPDATE UPDATE

cairo.pc is located in too places in my system. cairo.pc位于我系统的太多位置。 I have tried using each location in my pgg config path without success 我尝试在我的pgg配置路径中使用每个位置但没有成功

find /usr -name cairo.pc 
/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/cairo.pc
/usr/X11/lib/pkgconfig/cairo.pc

pkg-config --variable pc_path pkg-config
/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig

NOTE: only for Ubuntu. 注意:仅适用于Ubuntu。

Solving my problem was easier. 解决我的问题更容易。 The Ubuntu dependencies were just not installed properly, and you can find instructions here: Ubuntu依赖项未正确安装,您可以在此处找到说明:

https://github.com/LearnBoost/node-canvas/wiki https://github.com/LearnBoost/node-canvas/wiki

This is what worked for me: 这对我有用:

sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++

ln -s /usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/cairo.pc /usr/local/lib/pkgconfig/cairo.pc

解决了我的问题

I had this problem on Yosemite, and fixed it by reinstalling cairo. 我在优胜美地遇到了这个问题,并通过重新安装cairo来修复它。

$ brew unlink cairo
Unlinking /usr/local/Cellar/cairo/1.14.2... 30 symlinks removed
$ brew install cairo

You can use PKG_CONFIG_PATH for the same. 您可以使用PKG_CONFIG_PATH Ie: 即:

PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig ./configure ....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM