Make CAIRO_FORMAT_INVALID optional to support outdated versions of Cairo #342

terebentina opened this Issue Oct 12, 2013 · 11 comments


None yet

6 participants


Any chance you could do with CAIRO_FORMAT_INVALID what you did for CAIRO_FORMAT_RGB30 in this PR: #315 ?
From reading around, it seems it's the same problem.

This is what I get when trying to install canvas 1.1.1 with cairo 1.8.8-3.1.el6:

  CXX(target) Release/
In file included from ../src/
../src/PNG.h: In function ‘cairo_status_t canvas_write_png(cairo_surface_t*, void (*)(png_struct*, png_byte*, png_size_t), void*)’:
../src/PNG.h:161: error: ‘CAIRO_FORMAT_INVALID’ was not declared in this scope
make: *** [Release/] Error 1
kangax commented Oct 12, 2013

/cc @kkoopa

kkoopa commented Oct 13, 2013

Apparently, Cairo 1.8.8 was released in 2009 and CAIRO_FORMAT_INVALID officially appeared in 2010. The value is supposed to be -1. I don't know if anything will break by messing around with it, but at the same time I don't see if it is worth doing for a 4-year old version of a library that has received several updates since. Why can't you use a version of Cairo from this decade?

Either way, adding


somewhere before png.h:161 should probably work.


The reason is a CentOS 6.3 production server and not being allowed to install packages outside of yum repos.
I'll try your suggestion, thanks.

rvagg commented Oct 13, 2013

CentOS ... it's always CentOS causing problems for Node.

-1 to pandering to CentOS.

@rcoup rcoup added a commit to koordinates/node-canvas that referenced this issue Nov 27, 2013
@rcoup rcoup Add CAIRO_FORMAT_INVALID c1180d1

any update? how can I make this work?

rvagg commented Dec 23, 2013

@ericstob what's your specific use-case for this? CentOS too?

rcoup commented Dec 23, 2013

@rvagg mine was Ubuntu Lucid which is still in LTS support for a bit longer 😄

@ericstob add the patch / use the fork from koordinates@c1180d1 ala npm install git:// ?

rvagg commented Dec 23, 2013

Yeah, that patch is simple enough. If everything else works properly then +1 to getting this solved. Someone want to submit a PR to get koordinates@c1180d1 in? I don't see an existing PR for it.

rcoup commented Dec 24, 2013

@rvagg see #370 - I didn't bother originally since it seemed like your comments earlier were a #wontfix

rvagg commented Dec 24, 2013

@rcoup I'm not maintainer, just a noisy voice! However it does seem like a fairly easy fix to support Ubuntu LTS (I curse at CentOS) if you're experience is that everything else works fine.


I ended up moving to latest fedora so maybe you should keep this bug open :)

@kangax kangax closed this in #370 Dec 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment