View.gtk installation
To install view.gtk, you need to:
- Obtain a copy of the code. The newest version should be available here.
- You will of course have to open the compressed TAR file.
Contents
Windows
- A pre-compiled executable is available.
- To open the tar-file, you can use 7zip, or get a zip version instead here.
- Get the GTK bundle from http://www.gtk.org/download/index.php. You probably just need the newest "Run-time" GTK+ all-in-one bundle (e.g. GTK+ all-in-one bundle 2.16 Run-time).
- Unpack the bundle into a directory, e.g. C:\GTK
- Add into PATH the location of the GTK libraries (C:\GTK\bin or wherever you put it):
- Right click on "My Computer" and select "Properties", then "Advanced" tab, then "Environment Variables".
- Select the "PATH" variable and then "Edit"
- Add "C:\GTK\bin" to the items in the PATH variable. (Do not erase all the other things listed in PATH. Just add this item.)
- You may need to install libtiff.
- Download the "Complete package, Setup" file from here.
- Install libtiff by running the .exe
- Copy the file "libtiff3.dll" from the libtiff folder (C:\Program Files\GnuWin32\bin) to the folder where you put the "view.gtk-Win32.exe" executable.
- After copying over, you may need to rename "libtiff3.dll" to "libtiff-3.dll".
- You will need to create a directory called .view.gtk under your home directory, e.g. C:\Documents and Settings\user (given by the USERPROFILE environment variable). This directory is used to save the font setting and the experimental configurations.
- The "view.exe" file should now run.
Cygwin on Windows
On some Windows installations (especially Windows Vista and Windows 7), the above binary may not work. In that case, an alternative is to use Cygwin. You will need to install Cygwin and also the Cygwin packages (under "X11" category)
- gtk+
- libgtk2.0
- xorg-server
Once Cygwin is installed, and you've generated a view.gtk executable, you can run the program by doing (see this):
- Open cygwin window
- type:
- X -multiwindow &
- type:
- export DISPLAY=127.0.0.1:0.0
- Open the program you want, for instance:
- cd /cygdrive/c/cygwin/programs/
- ./view.exe
Note that you need a different "view.exe" file. The version for Windows and for Cygwin are different! You can compile your own (see below), or contact the beamline staff to get a copy of view.gtk compiled for Cygwin.
Compiling view.gtk for Cygwin
- Make sure you have Cywgin installed and working properly. You will also need to make sure you have these Cygwin packages installed:
- Devel:
- make
- gcc
- gcc-core
- gcc-g++
- libgcc1
- Libs
- libtiff-devel
- libtiff5
- X11:
- libgtk2.0-devel
- cairo
- libcairo-devel
- libcairo2
- Devel:
- Obtain a copy of the newest view.gtk code from here.
- Copy the downloaded tar-file into a directory you can reach from Cygwin. E.g. put it into "/home/username/compile/".
- Open a Cygwin terminal, and go the directory where you put the code:
- cd compile/
- Untar the file:
- tar -xvzf view.gtk.tar.gz
- Move into the src folder:
- cd view.gtk/src/
- Copy the correct makefile into this folder:
- cp Makefiles/Makefile.cygwin ./Makefile
- Compile by running:
- make
cairo.h not found
If you get a compile error like "/usr/include/gtk-2.0/gdk/gdkscreen.h:31:19: cairo.h: No such file or directory", even though you installed the cairo packages, you can try fixing it by copying the Cairo header files to the src directory:
- cp /usr/include/cairo/* ./
gdk-pixbuf.h not found
If you get a compile error like:
In file included from /usr/include/gtk-2.0/gdk/gdkcairo.h:28, from /usr/include/gtk-2.0/gdk/gdk.h:33, from /usr/include/gtk-2.0/gtk/gtk.h:32, from main.c:10: /usr/include/gtk-2.0/gdk/gdkpixbuf.h:37:35: gdk-pixbuf/gdk-pixbuf.h: No such file or directory
Find the file "gdk-pixbuf.h":
- cd /usr/include/gdk-pixbuf-2.0/gdk-pixbuf/
Then create a symlink so the compile can find it:
- cd /usr/include/gtk-2.0/
- ln -s /usr/include/gdk-pixbuf-2.0/gdk-pixbuf/ gdk-pixbuf
undefined reference to TIFF
If you get a compile error like "data.o: In function `load_pilatus_tiff': data.c:634: undefined reference to `_TIFFFdOpen'"... I'm not sure how to fix this.
Linux
- Open ('untar') the file:
- tar -xvzf view.gtk.tar.gz
- You will need to install the GTK development libraries:
- sudo aptitude install libgtk-dev
- You will also need a library for analyzing TIFF data:
- sudo aptitude install libtiff-dev
- Once these dependencies are installed, you should be able to simply make:
- cd view.gtk/src/
- make
- You should see:
- make
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o bitmap.o bitmap.c
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o callbacks.o callbacks.c
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o data.o data.c
- data.c: In function ‘load_mask’:
- data.c:121: warning: too few arguments for format
- data.c: In function ‘convert_to_ang_dist’:
- data.c:1507: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘double’
- data.c:1507: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘double’
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o draw.o draw.c
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o interface.o interface.c
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o main.o main.c
- gcc -g -c -I. `/usr/bin/pkg-config --cflags gtk+-2.0` -I/sw/include -o support.o support.c
- gcc -g -o view.gtk bitmap.o callbacks.o data.o draw.o interface.o main.o support.o -L/sw/lib -ltiff `/usr/bin/pkg-config --libs gtk+-2.0` -lgthread-2.0
- The executable "view" should then be available.
- You should then create a ".view.gtk" directory in your home directory:
- cd ~
- mkdir .view.gtk
Mac OS X
- Open ('untar') the file:
- tar -xvzf view.gtk.tar.gz
- Install the X11 environment for Mac OS X.
- Install "XCode", the OS X compiling tools.
- Install the fink packaging system for Mac OS X. You can download fink here.
- If you are inside the BNL firewall, you will probably need to:
- Go to http://wpad.bnl.gov/wpad.dat to determine the IP address of the proxy server.
- Configure fink:
- sudo fink configure
- When it asks for the proxy, use the IP address determined previously:
- Get fink to scan the package repository:
- sudo fink selfupdate
- Using fink, install "pkgconfig", "gtk+2-dev" and "libtiff". You do this by opening a terminal or X11 "xterm" window, and typing:
- fink update
- fink install pkgconfig
- fink install gtk+2-dev
- fink install libtiff
- Still in a terminal, go into the directory where you untarred the "view.gtk" code, then go into the "src" sub-directory:
- cd ~/view.gtk/
- cd src/
- You need to use the makefile specific to Mac OS X:
- cp ../Makefiles/Makefile.MAC-fink Makefile
- Then run the usual "make" command to compile everything:
- make
- You should then create a ".view.gtk" directory in your home directory:
- cd ~
- mkdir .view.gtk
The above procedure should generate a "view.gtk" executable file. You can run that file by opening a terminal (or xterm) and going into the appropriate directory and typing:
- ./view.gtk