Cairo pkgconfig requires xcb-shm package which is not installed #14123

Closed
adammw opened this Issue Aug 11, 2012 · 22 comments

Projects

None yet
@adammw
Contributor
adammw commented Aug 11, 2012

Running PKG_CONFIG_PATH=brew --prefix cairo/lib/pkgconfig pkg-config --cflags --print-errors cairo produces:

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
@adammw
Contributor
adammw commented Aug 11, 2012

My bad. They're in /opt/X11/lib/pkgconfig

@adammw adammw closed this Aug 11, 2012
@MikeMcQuaid
Member

Does this break any software?

@adammw
Contributor
adammw commented Aug 11, 2012

Not that I know of. I was writing a new formula, so I was getting this error and not understanding what's going on. Then I figured out that xcb-shm and other similar things have their pkg-config not on the default pkg-config search path, and that the proper way to get them included in the search path is to depends_on :x11

@MikeMcQuaid
Member

Can you see if this was fixed by by c21552a by any chance? It doesn't matter if it wasn't but just curious.

@Nek
Nek commented Sep 5, 2012

It does break compilation of mypaint from sources (it is not on brew yet).

@jacknagel
Contributor

If cairo is built with X support (the default), it will require this package. You can put your X11 pkgconfig directory (either /opt/X11/libpkgconfig or /usr/X11/lib/pkgconfig) on PKG_CONFIG_PATH as well so that it can find the libs. This is done automatically by Homebrew, but you'll have to do it manually if your are using cairo in your own software. You can also build it with "--without-x" if you don't need it, though e.g. gtk+ requires it.

Eventually the default will be flipped to "without-x", when my deps branch lands with support for passing options to deps.

@Nek
Nek commented Sep 5, 2012

I've tried doing this but it didn't help.

But thanks for the info. At least I know the problem is outside brew's packages handling.
Looks like the cause lies within mypaint's scons configuration.

On Wednesday, September 5, 2012 at 21:23 , Jack Nagel wrote:

If cairo is built with X support (the default), it will require this package. You can put your X11 pkgconfig directory (either /opt/X11/libpkgconfig or /usr/X11/lib/pkgconfig) on PKG_CONFIG_PATH as well so that it can find the libs. This is done automatically by Homebrew, but you'll have to do it manually if your are using cairo in your own software. You can also build it with "--without-x" if you don't need it, though e.g. gtk+ requires it.
Eventually the default will be flipped to "without-x", when my deps branch lands with support for passing options to deps.


Reply to this email directly or view it on GitHub (#14123 (comment)).

@alaboszhang

thanks adammw!!!

i coyped all /opt/X11/lib/pkgconfig/*.pc to /usr/local/lib/pkgconfig on my mac

then be ok!

@eelcocramer
Contributor

I was trying to 'npm install canvas' (https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX). Canvas requires cairo. The installation of canvas fails because of the package 'xcb-shm', required by 'cairo', was not found.

I fixed this issue by copying the files like the above comment suggests and this fixes the issue but this isn't an elegant solution.

@adammw
Contributor
adammw commented Sep 21, 2012

Copying pkgconfig files is not a good idea. Symlinking is better but still not brilliant. I've just exported /opt/X11/lib/pkgconfig in my PKG_CONFIG_PATH in .bashrc and it seems to work fine now when manually building things.

@eelcocramer
Contributor

Much better. Thanks.

@avsm avsm referenced this issue in ocaml/opam-repository Oct 15, 2012
Closed

lablgtk is broken on OSX #112

@ozataman

@alaboszhang thanks for that pkgconfig tip - helped me finish "waf configure" step when installing py2cairo

@JoeOsborn

The fceux formula wants /opt/X11/lib/pkgconfig in PKG_CONFIG_PATH too. Should that be part of the X11 installation process, or something? An advice, at least (if it's not already)?

@jhgorse
Contributor
jhgorse commented Apr 11, 2013

Just for the record, the pkg-config path for linking to Cairo things, such as for a gtk-engine for a theme, went a little like this before running ./configure

setenv PKG_CONFIG_PATH "brew --prefix cairo/lib/pkgconfig:/usr/local/opt/pixman/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/X11/lib/pkgconfig"

This thread popped up on Google when I got stumped on xcb-shm. Cheers.

@MerelyAPseudonym
Contributor

+1 for "This thread popped up on Google when I got stumped on xcb-shm."
And —what the heck— +1 for the "Cheers." too. =P

(I, too, was briefly baffled by an error, but this page proved useful to me and I solved the problem.)

Specifically, I was trying to install the supporting software for The Haskell School of Expression with cabal install soegtk. I mention that only to lay a Google breadcrumb for anyone else who tries to do the same in the future.

@mcs07 mcs07 referenced this issue in openbabel/openbabel Jun 28, 2013
Merged

Still attempt to find Cairo even if pkgconfig fails #13

@MylesBorins
Contributor

I know this was closed a little while ago but I ran into this issue this evening trying to install canvas via npm....
This ended up being solved by manually exporting the PKG_CONFIG_PATH with the following command

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

This is not a particularly elegant solution imho

@adius adius referenced this issue in adius/fakesome Nov 3, 2013
Closed

"npm install fakesome" fails under windows #1

@syncube
syncube commented Dec 6, 2013

Still while installing canvas via npm manual export of export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig is needed.

@zsitro
zsitro commented Dec 13, 2013

+1 for @TheAlphaNerd

@codazzo
codazzo commented Dec 21, 2013

Thanks @TheAlphaNerd !

@mitar
mitar commented Feb 15, 2014

But files from /opt/X11/lib/pkgconfig are those installed by xquartz and not those from Homebrew. So you get a version of Cairo installed by xquartz and not one from Homebrew.

@gilesbutler

Same issue trying to install css-sprite which depends on canvas. This fixed it for me as well:
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

I tried installing Cairo through Homebrew first so I presume I have 2 copies of it installed as the above comment mentions its installed by xquartz as well.

Will this solution hold up in the long term or could updates break it?

@mlegenhausen mlegenhausen referenced this issue in Automattic/node-canvas Mar 19, 2014
Closed

npm install fails on OSX Mavericks #389

@mikatalk

Thanks @adammw !!

@jacknagel jacknagel locked and limited conversation to collaborators Jul 30, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.