'How to compile GTK2 source code?

I'm trying to modify GTK2 on Ubuntu Oneiric.

I download the source:

apt-get source libgtk2.0-0
cd gtk+2.0-2.24.6/

I try to compile and overwrite the current GTK2:

./configure --prefix=/usr
sudo make

Soemhow I get an error (I have all the necessary libraries and the build-essential package etc):

In file included from gtkquery.c:26:0:
gtkquery.h:31:2: error: #error "gtkfilechooserprivate.h is not supported API for general use"

By the way, I am able to modify and recompile GTK3 with no problems with the same steps.

If use debuild, I get thousands of

dpkg-source: error: cannot represent change to gtk+2.3.0-2.24.6/gtk+2.0-2.24.6/something: binary file contents changed


Solution 1:[1]

You won't get anything near the Ubuntu-provided build if you try building it by hand that way -- you'll miss all the ./configure options and other settings. (Look into debian/rules for the full details of what they're setting.)

Instead, try debian/rules build.

For reasons I haven't investigated yet (possibly including me not understanding how it should work), that didn't work on the first package I tried, but setting up pbuilder let me build the package I wanted.

It might feel like overkill to get a clean chroot as a build environment, but it is way too easy to build yourself problems that no one else in the world can replicate because you've got something funny on your local system.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sarnold