How to compile GTK2 on Linux machine without administrator privileges?

3

I'm working on a "SUSE Linux Enterprise Server 10 (x86_64)" machine, which has GVim version 6.4.6, which is quite old, and not supported by some plugins.

This is a corporate machine, and no one will do any administrative changes just because I want to have an alignment plugin...

I've downloaded and successfully compiled version 7.3, with "configure --prefix=/my/local/dir" command.

However, it doesn't recognize GTK2, and keep using the ugly Motif GUI. It seems that I have too old GTK installed: "checking for GTK - version >= 2.2.0... no"

I've tried to manually install the GTK2 dev package into local path, but it failed. Any ideas how can I continue?..

Thanks...

EDIT

"It failed" - means that I installed glib2, but pango didn't see it. Then I tried jhbuilder, but it just gave strange errors that Googling didn't gave solution...

Zvika

Posted 2013-01-14T14:33:33.560

Reputation: 69

Answers

1

"but it failed" does not provide enough information about what went wrong, but I have a few hunches. What specific command line options are you trying to use? What error message do you receive?

A few tips for building stuff locally:

  • You might need other updated dependencies such as GLib.
  • For Autoconf-based programs (that is, usually, given away by the fact that a ./configure script exists), you need to specify --prefix=/some/writable/dir as well as set the environment variable PKG_CONFIG_PATH to point pkg-config at the right place.
  • You basically need to create a directory, e.g. /home/you/usr which is your local equivalent to /usr, and convince the build scripts of libraries such as GLib and GTK to use /home/you/usr for everything -- when in doubt, run the config script with strace -Ff -eopen if you can, and see what files it accesses in /usr and then google a way to get it to look in /home/you/usr instead.
  • You may also have to override the default install path for libraries by passing --libdir=/home/you/usr/lib to the configure script.
  • The linkage -- that is, which directories are taken to be linked against for each link step -- is handled by correctly installing the .pc files for the dependency libraries into /home/you/usr/lib/pkg-config. So, in other words, the automatically-generated .pc files that get installed into /home/you/usr/lib/pkg-config when you run make install on an autotooled program will, assuming you set PKG_CONFIG_PATH correctly, tell the compiler to link against /home/you/usr/lib/libglib-2.0.so and not /usr/lib/libglib-2.0.so (for example).

allquixotic

Posted 2013-01-14T14:33:33.560

Reputation: 32 256

1

Well, thanks to allquixotic, I have now a beautiful local GVim7.3 :)

To the benefit of future readers, I'll summarize it up. (hoping that I didn't forget anything...):

Before running:

setenv CPPFLAGS "-I/local/path/usr/include"
setenv LDFLAGS "-L/local/path/usr/lib"
setenv LD_LIBRARY_PATH "/local/path/usr/lib"
setenv PKG_CONFIG_PATH "/local/path/usr/lib/pkgconfig"

In each component, compile with the following commands:

./configure --prefix=/local/path/usr
make
make install

Now, these are the versions I've used (note that the order is important):

glib-2.10.3
atk-1.9.1
freetype-2.2.1
fontconfig-2.3.97
cairo1.0.4
pixman0.9
pango-1.12.4
gtk+-2.8.20

After that, I could compile Vim7.3 with the following configuration:

   configure --prefix=/local/path/usr --with-features=big --enable-gui=gtk2 | tee config.log

And verify that gtk is found.

Zvika

Posted 2013-01-14T14:33:33.560

Reputation: 69