View.gtk installation

From GISAXS
Revision as of 13:13, 6 June 2014 by KevinYager (talk | contribs) (Windows)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To install view.gtk, you need to:

  1. Obtain a copy of the code. The newest version should be available here.
  2. You will of course have to open the compressed TAR file.

Windows

  1. A pre-compiled executable is available.
  2. To open the tar-file, you can use 7zip, or get a zip version instead here.
  3. 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).
  4. Unpack the bundle into a directory, e.g. C:\GTK
  5. Add into PATH the location of the GTK libraries (C:\GTK\bin or wherever you put it):
    1. Right click on "My Computer" and select "Properties", then "Advanced" tab, then "Environment Variables".
    2. Select the "PATH" variable and then "Edit"
    3. 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.)
  6. You may need to install libtiff.
    1. Download the "Complete package, Setup" file from here.
    2. Install libtiff by running the .exe
    3. 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.
    4. After copying over, you may need to rename "libtiff3.dll" to "libtiff-3.dll".
  7. 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.
  8. 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):

  1. Open cygwin window
  2. type:
    X -multiwindow &
  3. type:
    export DISPLAY=127.0.0.1:0.0
  4. 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

  1. 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
  2. Obtain a copy of the newest view.gtk code from here.
  3. Copy the downloaded tar-file into a directory you can reach from Cygwin. E.g. put it into "/home/username/compile/".
  4. Open a Cygwin terminal, and go the directory where you put the code:
    cd compile/
  5. Untar the file:
    tar -xvzf view.gtk.tar.gz
  6. Move into the src folder:
    cd view.gtk/src/
  7. Copy the correct makefile into this folder:
    cp Makefiles/Makefile.cygwin ./Makefile
  8. 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

  1. Open ('untar') the file:
    tar -xvzf view.gtk.tar.gz
  2. You will need to install the GTK development libraries:
    sudo aptitude install libgtk-dev
  3. You will also need a library for analyzing TIFF data:
    sudo aptitude install libtiff-dev
  4. 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.
  5. You should then create a ".view.gtk" directory in your home directory:
    cd ~
    mkdir .view.gtk


Mac OS X

  1. Open ('untar') the file:
    tar -xvzf view.gtk.tar.gz
  2. Install the X11 environment for Mac OS X.
  3. Install "XCode", the OS X compiling tools.
  4. Install the fink packaging system for Mac OS X. You can download fink here.
  5. If you are inside the BNL firewall, you will probably need to:
    1. Go to http://wpad.bnl.gov/wpad.dat to determine the IP address of the proxy server.
    2. Configure fink:
      sudo fink configure
    3. When it asks for the proxy, use the IP address determined previously:
      http://192.168.1.165:3128
    4. Get fink to scan the package repository:
      sudo fink selfupdate
  6. 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
  7. 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/
  8. You need to use the makefile specific to Mac OS X:
    cp ../Makefiles/Makefile.MAC-fink Makefile
  9. Then run the usual "make" command to compile everything:
    make
  10. 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