Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SWT/Devel/Gtk/Compiling Gtk"

< SWT‎ | Devel‎ | Gtk
m
m
Line 29: Line 29:
 
     ~/src/gtk_versions/
 
     ~/src/gtk_versions/
  
== See also ==
+
== Dealing with make build failures ==
 +
Building GTK can be a tricky. You may run into the following issues:
 +
 
 +
=== Build failure due to missing packages ===
 +
The build can fail if you are missing certain packages.
 +
 
 +
For example make may fail with:
 +
 
 +
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
 +
 
 +
In such cases you can do the following to resolve the build issues:
 +
 
 +
* Google the error message/file. Ex google "redhat-hardened-cc1: No such file or directory. You often bump into threads that tell you which packages to install.
 +
 
 +
* Use dnf to find out which package contains the necessary file:
 +
 
 +
    sudo dnf provides '*/redhat-hardened-cc1'
 +
 
 +
=== Incorrect versions of libraries ===
 +
You may run into error messages during configuration about some of your libraries being too old. To resolve this issue, the easiest way is to upgrade your Fedora (or other linux distro) to the newest or beta versions (rawhide).
 +
 
 +
== Also ==
 
To find out how to run SWT snippets with the compiled GTK, see [[SWT/Devel/Gtk/Dev_guide#Set_the_SWT_widget_to_use_the_new_GTK | Set widget to use new gtk]]
 
To find out how to run SWT snippets with the compiled GTK, see [[SWT/Devel/Gtk/Dev_guide#Set_the_SWT_widget_to_use_the_new_GTK | Set widget to use new gtk]]

Revision as of 17:37, 17 May 2016

Getting Gtk

Make sure you have git installed, and then clone the Gtk git repository using the following command in the directory you wish to have the Gtk repository:

    git clone https://github.com/GNOME/gtk.git

This will create a gtk directory in your current directory. Enter this directory once git has finished downloading all the files.

Gtk Versions

You can see which versions are available to checkout by typing:

    git branch -a

This will list all available branches. Pick the branch with the version of Gtk that you want. For example, if I wanted to checkout Gtk3.12, it would usually look like this:

    git checkout gtk-3-12

Alternatively, if you need micro version support (i.e. you want to check out Gtk3.12.2 instead of Gtk3.12.4), then use git checkout like so:

    git checkout 3.12.2

Note that after you switch branches, you need to do a git clean to remove any changes between branches. Run this command:

    git clean -xdf            #d=directory, f=force, x=clean ignored files

Compiling Gtk

When in the parent gtk directory, run the following commands in order, after each one stops executing:

    ./autogen.sh
    ./configure
    make

For more detailed configuration/compilation options, see Leo's guide here.

Once make has finished running, you will have a .libs directory in the /gtk/gtk/ directory. This is useful for running SWT snippets or Eclipse apps using a specific version of Gtk. It is wise to copy the entire gtk parent directory to another directory, so you do not have to compile that Gtk version again. For example, I keep my various compiled versions in a folder named:

    ~/src/gtk_versions/

Dealing with make build failures

Building GTK can be a tricky. You may run into the following issues:

Build failure due to missing packages

The build can fail if you are missing certain packages.

For example make may fail with:

   gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory

In such cases you can do the following to resolve the build issues:

  • Google the error message/file. Ex google "redhat-hardened-cc1: No such file or directory. You often bump into threads that tell you which packages to install.
  • Use dnf to find out which package contains the necessary file:
   sudo dnf provides '*/redhat-hardened-cc1'

Incorrect versions of libraries

You may run into error messages during configuration about some of your libraries being too old. To resolve this issue, the easiest way is to upgrade your Fedora (or other linux distro) to the newest or beta versions (rawhide).

Also

To find out how to run SWT snippets with the compiled GTK, see Set widget to use new gtk

Back to the top