Required software for compiling this library #1

Closed
ghost opened this Issue Feb 8, 2011 · 7 comments

Projects

None yet

2 participants

@ghost
ghost commented Feb 8, 2011

Hi,

What are the pre-requisite SW needed for building gtk-fortran ? When I try this

gfortran `pkg-config --cflags --libs gtk+-2.0`  ./gtkhello2.f90

I get the following error:

Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
./gtkhello2.f90:28.9:

use gtk
       1
Fatal Error: Can't open module file 'gtk.mod' for reading at (1): No such file or directory

I'm using Ubuntu 10.10 (Maverick). I tried to install "libgtk-2.0-dev" but it seems to pull along a whole lot of baggage (~ 46 packages to be installed for libgtk-2.0-dev to work !). The non-dev version is already installed. I'm not willing to waste > 100 MB space just to compile 2 *.f90 files. So, I was wondering if there is a simpler / easier way.

@vmagnin
Collaborator
vmagnin commented Feb 8, 2011

Hi, try to compile with:
gfortran pkg-config --cflags --libs gtk+-2.0 ./gtkhello2.f90 ../src/gtk.f90

Note that you will probably need gfortran 4.6.0 (devel. version):
http://gfortran.org/download/i686/
Even in gfortran 4.5 there was a bug preventing to compile those examples.

The GTK+ version is 2.22 (I also work under Ubuntu 10.10).
I think you really need to install "libgtk-2.0-dev" to compile and link any Fortran program using GTK+. And when you first install a dev package, a lot of other package are needed to allow compiling/linking.

But Jerry will surely give you more details about that.

@jerryd
Owner
jerryd commented Feb 9, 2011

What I have learned just tonight is that one need a recent version of gfortran 4.6 to compile. At least a few months ago version does not work from a compiler bug now fixed.

Yes you do need the dev packages for gtk+2.0 installed also.

@ghost
ghost commented Feb 14, 2011

Thanks Jerry and Vincent. I installed the "dev" packages & very happy to see the Hello World program ! Also works fine with Intel Fortran 12.0.0 on x86-ubuntu-maverick, it took a long time to compile (~10 minutes) but GFortran was fast. I'll probably start writing some examples, similar to those in GTK tutorial. And many thanks for the wiki page, is very helpful !

@vmagnin
Collaborator
vmagnin commented Feb 15, 2011

Hi Satish,
thank you for your help. The information about Linux Intel Fortran is interesting. First because it works, secondly because it is so long to compile. I suppose you used the gtk.f90 file in the devel branch, which is becoming quite big. When I use gfortran under linux it takes around 20 seconds to compile. But gfortran under Windows 7 takes also 5 to 10 minutes ! Why so huge differences ? There is something interesting here about the functioning of compilers. I am not a specialist but perhaps Jerry has something to tell about this problem.

We have to think about the possibility of dividing the gtk-auto.f90 into several smaller files. Compiling would be faster but we would have to choose which module we need to use in each program. I am opened on that question (technically it is easy, the script has already the functionality to do this).

@vmagnin
Collaborator
vmagnin commented Feb 15, 2011

Another solution to compile fast is to delete the include "gtk-auto.f90" statement in gtk.f90 and copy from gtk-auto.f90 only the interfaces of the GTK+ functions you need in your program.

@jerryd
Owner
jerryd commented Mar 13, 2011

Is there some logical way to break these up into perhaps multiple module files? and do so in a way that there are no inter-dependencies

@vmagnin
Collaborator
vmagnin commented Mar 13, 2011

It is possible to split gtk-auto following the headers directories.
All the header files of GTK+ = 3.4 Mio:
"/usr/include/gtk-2.0/gdk": 345 Kio

"/usr/include/gtk-2.0/gtk": 1.3 Mio

"/usr/include/cairo": 130 Kio

"/usr/include/pango-1.0": 175 Kio

"/usr/include/glib-2.0": 1.3 Mio ("gio": 589 Kio, "glib": 439 Kio, "gobject": 239 Kio)

"/usr/include/gdk-pixbuf-2.0": 59 Kio

"/usr/include/atk-1.0": 171 Kio

But note that the gtk directory is the biggest (1.3 Mio) and will generally always be required. So the compiling time would be smaller but still long.
We could also have a smaller granularity by grouping gtk header files into several modules.

@vmagnin vmagnin closed this Apr 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment