What is Cairo, and how is it related to GTK and/or OpenGL when building for Linux?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
leafblower
In need of some credit
In need of some credit
Posts: 3
Joined: Sat Jun 15, 2019 10:10 am

What is Cairo, and how is it related to GTK and/or OpenGL when building for Linux?

Post by leafblower »

I am just getting started trying to learn the build system of wxWidgets with Linux, but as I am experimenting with different ways of setting up everything, I occasionally get a build error (primarily w/ CMake in either CLion or console) that says cairo.h is missing.

Apart from being the capital of Egypt, Google tells me it's also a graphics library targeted for (among others) the X Window System (X11).
First, isn't Linux using GTK, and isn't GTK mutually exclusive with X11?
Why is CMake searching for cairo.h if my wxWidgets build is configured for Ubuntu? :?

More to the point, how exactly is Cairo used within wxWidgets in relation to native build systems? Given that a wxWidgets-build for Ubuntu also needs the cairo header file, is it trying to interface to a package that is supposed to be installed on the OS or is it needed in some other way? Why is there a cairo.cpp present in the wxWidgets folder but not a cairo.h?

sorry for the TL;DR, but any clarity in this question would be greatly appreciated [-o<
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: What is Cairo, and how is it related to GTK and/or OpenGL when building for Linux?

Post by DavidHart »

Hi,

What are you trying to do? Build wxWidgets itself, or build a program against it? And which wxWidgets version are you using?
(primarily w/ CMake...
If you're trying to use cmake to build wxWidgets itself, be aware that it's a recent innovation and bugs are to be expected. I suggest you instead use the standard '../configure and make' method.

First, isn't Linux using GTK
You mean, "Isn't the wxWidgets Linux port, wxGTK, using gtk+?". Yes, it is. The 3 alternative wx Linux ports, wxX11 (old, barely maintained), wxMotif (don't even think about it!) and the work-in-progress wxQT, don't use gtk+.
and isn't GTK mutually exclusive with X11
No, gtk+ makes x11 calls. wxGTK and wxX11 are different ports, but that doesn't affect the native toolkits that they wrap.
how exactly is Cairo used within wxWidgets in relation to native build systems?
Without looking at the source-code I wouldn't like to guess. But why do you need to know? A major advantage of a toolkit like wxWidgets is that it prevents you needing to learn about the native implementation details.
Given that a wxWidgets-build for Ubuntu also needs the cairo header file, is it trying to interface to a package that is supposed to be installed on the OS or is it needed in some other way?
Most likely you haven't properly installed libgtk2.0-dev (or, for gtk+3, libgtk-3-dev) and its dependencies.

Regards,

David
leafblower
In need of some credit
In need of some credit
Posts: 3
Joined: Sat Jun 15, 2019 10:10 am

Re: What is Cairo, and how is it related to GTK and/or OpenGL when building for Linux?

Post by leafblower »

Awesome reply :) and I think it helps me better understand what questions I want to ask.
You mean, "Isn't the wxWidgets Linux port, wxGTK, using gtk+?". Yes, it is. The 3 alternative wx Linux ports, wxX11 (old, barely maintained), wxMotif (don't even think about it!) and the work-in-progress wxQT, don't use gtk+
Does that mean that wxQT will be the only viable port for Linux in the future? Will the licensing sphere of Qt affect how that port can be used, or will it be the regular L-GPL just like the rest of wxWidgets?
I suggest you instead use the standard '../configure and make' method.
I have tried both cmake and the standard '../configure and make' to build wxWidgets, but only CMake to build the samples. The cairo.h-file (among other .h-files) has occasionally been missing in both situations (and not consistently either, which is even more confusing).
If you're trying to use cmake to build wxWidgets itself, be aware that it's a recent innovation and bugs are to be expected.
That's good to know. My main attraction to CMake has been the CLion IDE, but the aforementioned inconsistency in setting up/building the sample projects is really challenging the gap in understanding I have between CMake/CLion and wxWidgets.


Thanks again for the reply!

-LB
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: What is Cairo, and how is it related to GTK and/or OpenGL when building for Linux?

Post by DavidHart »

Does that mean that wxQT will be the only viable port for Linux in the future?
No, I didn't mean that at all. I hope that wxQT will become a complete and viable alternative to wxGTK, but afaik it's not there yet. It is highly unlikely to replace wxGTK though.
I have tried both cmake and the standard '../configure and make' to build wxWidgets, but only CMake to build the samples.
That's an unusual thing to do. If you ../configure wxWidgets, the samples get configured too. Once you've built wxWidgets, to build a sample you just cd into its dir and run 'make'.
My main attraction to CMake has been the CLion IDE
There are wx-friendly alternatives...
Post Reply