Compilation fails on cairo-features.h and others

The cairo development package installs its header files in /usr/include/cairo, so changing the cairo includes from “cairo-features.h” to “cairo/cairo-features.h” etc. fixes it.

The broken includes are in openFrameworks/graphics/ofCairoRenderer.cpp

openframeworks comes with its own version of cairo, it doesn’t use the system library afaik.
also, what OS are you on, most linuxes compile fine, still some weird things going on in debian: http://videosynthesis.net/oftesting/

I don’t see any cairo header files in of_v0073_linux64_release:

[paul@watt of_v0073_linux64_release]$ find -name cairo.h
[paul@watt of_v0073_linux64_release]$

This is Fedora 17. I downloaded and unpacked v0073 from the downloads page.

hm, that’s what I get for looking in the git repo, where cairo is there, for other OSes. sorry 'bout that.

i checked, though, and on my ubuntu32, the cairo header files are also in /usr/include/cairo/, and OF compiles flawlessly. checking the build log, there’s a -I/usr/include/cairo in the g++ call, so that’s why this works. does it not do that in your case? maybe there’s just that include path missing in the makefile. in that case, would you report a bug at https://github.com/openframeworks/openFrameworks/issues please?

can you try running in the command line:

pkg-config cairo --cflags

and post what that returns, the makefiles use pkg-config to choose the correct flags for each package for cairo it adds the /usr/include/cairo include but it could be different in latest fedora or the pkg-config could be corrupt

[paul@watt of_v0073_linux64_release]$ pkg-config cairo --cflags
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15

[paul@watt linux64]$ make Debug
compiling object for …/…/…/openFrameworks/graphics/ofCairoRenderer.cpp
mkdir -p obj/Debug/openFrameworks/graphics
g++ -g3 -Wall -fexceptions -I…/…/…/assimp/include -I…/…/…/assimp/include/Compiler -I…/…/…/fmodex/include -I…/…/…/FreeImage/include -I…/…/…/freetype/include -I…/…/…/freetype/include/freetype2 -I…/…/…/freetype/include/freetype2/freetype -I…/…/…/freetype/include/freetype2/freetype/internal -I…/…/…/freetype/include/freetype2/freetype/internal/services -I…/…/…/freetype/include/freetype2/freetype/config -I…/…/…/kiss/include -I…/…/…/portaudio/include -I…/…/…/rtAudio/include -I…/…/…/tess2/include -I…/…/…/poco/include -I…/…/…/glu/include -I…/…/…/openFrameworks/ -I…/…/…/openFrameworks/3d -I…/…/…/openFrameworks/sound -I…/…/…/openFrameworks/types -I…/…/…/openFrameworks/communication -I…/…/…/openFrameworks/video -I…/…/…/openFrameworks/events -I…/…/…/openFrameworks/graphics -I…/…/…/openFrameworks/math -I…/…/…/openFrameworks/utils -I…/…/…/openFrameworks/gl -I…/…/…/openFrameworks/app -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/GL -DOF_USING_MPG123 -MMD -MP -MFobj/Debug/openFrameworks/graphics/ofCairoRenderer.d -MTobj/Debug/openFrameworks/graphics/ofCairoRenderer.o -o obj/Debug/openFrameworks/graphics/ofCairoRenderer.o -c …/…/…/openFrameworks/graphics/ofCairoRenderer.cpp
In file included from …/…/…/openFrameworks/graphics/ofCairoRenderer.cpp:1:0:
…/…/…/openFrameworks/graphics/ofCairoRenderer.h:10:28: fatal error: cairo-features.h: No such file or directory
compilation terminated.
make: *** [obj/Debug/openFrameworks/graphics/ofCairoRenderer.o] Error 1

So libs/openFrameworksCompiled/project/linux64/makefile makes no mention of cairo. libs/openFrameworksCompiled/project/makefileCommon/Makefile.linux does, but that makefile is not used, as far as I can tell.

do you see any other errors? it’s possible that it’s not getting some other pkg-config configuration and fails to setup all the rest of the packages, can you post the whole output in a pastebin or similar

The cairo includes are the only error. Adding cairo to the pkg-config command in linux64/makefile fixes it:

— makefile~ 2012-11-14 14:49:59.000000000 -0500
+++ makefile 2012-11-30 19:28:35.568827543 -0500
@@ -114,7 +114,7 @@

ifneq ($(ARCH),android)

  • CFLAGS += $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 libudev glew --cflags)
  • CFLAGS += $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 libudev glew cairo --cflags)
    #check if gtk exists and add it
    GTK = $(shell pkg-config gtk±2.0 --exists; echo $$?)
    ifeq ($(GTK),0)

After manually making the above change, it compiles. Then I can compile and run the examples in code::blocks.

oh, wow, cairo should be there, i guess in older distributions there’s some dependency between gstreamer and cairo that makes it included. thanks

arturo will you fix this?

Getting similar errors when trying to build 0073 from install_dependencies.sh on Debian squeeze (i686).

Have tried the various fixes suggested in this thread, but I’m still getting the following cairo-related errors:

  
  
../../../openFrameworks/graphics/ofCairoRenderer.cpp: In member function ‘virtual void ofCairoRenderer::setBlendMode(ofBlendMode)’:  
../../../openFrameworks/graphics/ofCairoRenderer.cpp:612: error: ‘CAIRO_OPERATOR_MULTIPLY’ was not declared in this scope  
../../../openFrameworks/graphics/ofCairoRenderer.cpp:617: error: ‘CAIRO_OPERATOR_SCREEN’ was not declared in this scope  
../../../openFrameworks/graphics/ofCairoRenderer.cpp:622: error: ‘CAIRO_OPERATOR_DIFFERENCE’ was not declared in this scope  
../../../openFrameworks/graphics/ofCairoRenderer.cpp: At global scope:  
../../../openFrameworks/graphics/ofCairoRenderer.cpp:10: warning: ‘void helper_quadratic_to(cairo_t*, double, double, double, double)’ defined but not used  
make: *** [obj/Debug/openFrameworks/graphics/ofCairoRenderer.o] Error 1  
  

Here’s the output of pkg-config cairo --cflags:

  
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12  

Hit a wall now. My home environment is OSX, a bit lost this deep in linux territory…

These don’t look related to the original error. You should probably start a new thread.

My WAG: you have a different version of cairo than the one ofx needs.

do you have any other errors or is only that? i’m checking the latest version of cairo and that constants haven’t changed

can you check the file cairo.h and see if that constants are there?

running install_dependencies.sh on Ubuntu 12.10 I also ran into this issue. Editing the file ofCairoRenderer.h solved this.

old:

  
#include "cairo-features.h"  
#include "cairo-pdf.h"  
#include "cairo-svg.h"  
#include "cairo.h"  

new:

  
#include "cairo/cairo-features.h"  
#include "cairo/cairo-pdf.h"  
#include "cairo/cairo-svg.h"  
#include "cairo/cairo.h"  

apart from this I also have to install few other dependencies, like libcairo2-dev, freeglut3-dev, libudev-dev, libglew-dev, libopenal-dev

what version of OF are you using? those dependencies are already installed by install_dependencies also the correct cairo include is without the cairo/ it should be related to the packages you are missing

sorry to post the previous post twice, something went wrong here.
I just downloaded of_v0.7.4_linux64_release. Now the script stops here:

  
Package jack was not found in the pkg-config search path.  
Perhaps you should add the directory containing `jack.pc'  
to the PKG_CONFIG_PATH environment variable  
No package 'jack' found  
linking x86_64 bin/projectGeneratorSimple linux64  
mkdir -p bin  
g++ -o bin/projectGeneratorSimple   
... lots of code...  
/usr/bin/ld: cannot find -lasound  
/usr/bin/ld: cannot find -lportaudio  
collect2: error: ld returned 1 exit status  
make: *** [bin/projectGeneratorSimple] Error 1  
there has been a problem compiling the projectGenerator  
please report this problem in the forums  
  

This seems related to being unable to install jack-dev. Portaudio depends on jack-dev. I memorize having had this kind of issue over a year ago. It had to do with packages installed by other software, that inhibit the right version of Jack from installing correctly.

  
sudo apt-get install libjack-dev  
...  
The following packages have unmet dependencies:  
 libjack-dev : Depends: libjack0 (= 1:0.121.3+20120418git75e3e20b-2) but it is not going to be installed  

However I am unsure what to uninstall to solve this, since my installation of Ubuntu is really fresh…

Solved this issue with:

  
sudo apt-get install libjack-jackd2-dev  

Found here: http://askubuntu.com/questions/174788/sudo-apt-get-build-dep-ffmpeg-fails-because-of-libjack0-in-ubuntu-12-04
Now all builds fine. However I do not know if that would also fix the previous problems; those are changes I kept to finish this build.

I shall add here - for the shake of completeness,
that libjack alone does not fix it for me.

what does, is installing the “libusb-dev” and “libusb-1.0-0-dev”

Hello, I’m trying with Ubuntu 12.04 and have same issue:

ofCairoRenderer.h have the next includes:

#include “cairo-features.h”
#include “cairo-pdf.h”
#include “cairo-svg.h”
#include “cairo.h”
#include
#include
#include “ofMatrix4x4.h”
#include “ofBaseTypes.h”
#include “ofPath.h”

and when I build a project, fails with cairo-features.h:

…/…/…/libs/openFrameworks/graphics/ofCairoRenderer.h:4:28: fatal error: cairo-features.h: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

I read the topic but I did’nt find the solution. Any help will be very preciated.

Thanks,
Charlie

I just had the same problem, trying to compile a project, running into:

fatal error: cairo-features.h: No such file or directory

Reinstalling “libusb-dev” and “libusb-1.0-0-dev” fixed it for me. (i had uninstalled them recently for other reasons).

ON: of_v0.8.3, Ubuntu 14.04 LTS 64-bit