Skip to content

Error on installing on Ubuntu Server #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
skotchio opened this issue Aug 1, 2013 · 3 comments · Fixed by #315
Closed

Error on installing on Ubuntu Server #312

skotchio opened this issue Aug 1, 2013 · 3 comments · Fixed by #315

Comments

@skotchio
Copy link

skotchio commented Aug 1, 2013

When I try to install node-canvas on my Ubuntu Server 12.04 I get the following error:

In file included from ../src/Canvas.cc:8:0:
../src/PNG.h: In function 'cairo_status_t canvas_write_png(cairo_surface_t*, png_rw_ptr, void*)':
../src/PNG.h:139:10: error: 'CAIRO_FORMAT_RGB30' was not declared in this scope

What does it mean?

@kkoopa
Copy link
Contributor

kkoopa commented Aug 4, 2013

Your version of Cairo is too old. CAIRO_FORMAT_RGB30 was added in some version later than the one normally available on Ubuntu 12.04. You can either upgrade Cairo by getting it and necessary dependencies from Raring Ringtail, or patch PNG.h and replace CAIRO_FORMAT_RGB30 with 5. I don't know how stable the latter approach is, it might work fine --- it might not, so I recommend the first option.

Edit /etc/apt/sources.list and add the sources for raring ringtail.

deb http://archive.ubuntu.com/ubuntu raring main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu raring main restricted universe multiverse

Edit /etc/apt/apt.conf.d/01ubuntu and add the line APT::Default-Release "precise"; to set your default apt source to Precise Pangolin.

Then edit /etc/apt/preferences.d/libcairo2-pin-400 and pin the required packages to Raring Ringtail.

Package: libcairo2
Pin: release n=raring
Pin-Priority: 400

Package: libcairo2-dev
Pin: release n=raring
Pin-Priority: 400

Package: libcairo-gobject2
Pin: release n=raring
Pin-Priority: 400

Package: libcairo-script-interpreter2
Pin: release n=raring
Pin-Priority: 400

Package: libpixman-1-0
Pin: release n=raring
Pin-Priority: 400

Package: libpixman-1-dev
Pin: release n=raring
Pin-Priority: 400

Package: fontconfig-config
Pin: release n=raring
Pin-Priority: 400

Package: libfontconfig1
Pin: release n=raring
Pin-Priority: 400

You can now run apt-get install libcairo2-dev -t raring to install the newer version of Cairo from Raring Ringtail.

For more information, read the man page: man apt_preferences.

@skotchio
Copy link
Author

skotchio commented Aug 4, 2013

Thanks!

@distracteddev
Copy link

For anyone else that might stumble upon this I thought I should add that you need to run sudo apt-get update after editing the files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants