GLE for Linux Installation Guide

This tutorial explains how to install, configure, and run GLE on Linux (and Cygwin).

Installing GLE

The GLE version used in this tutorial is 4.0.12. A preview of this version is available here. Note: this tutorial is NOT compatible with 4.0.11 and before.

I assume that you have donwloaded GLE-x.y.z-src.zip with x.y.z the version number and saved it in your home directory. Open a terminal (e.g., gnome-terminal or konsole) and unzip the archive as follows.

[~]$ cd
[~]$ unzip GLE-4.0.12-src.zip
Archive:  GLE-4.0.12-src.zip
  inflating: gle4/Makefile.gcc
  inflating: gle4/Makefile.in
  ...
  inflating: gle4/src/samples/Makefile.vc
  inflating: gle4/src/samples/sample.gle
  inflating: gle4/src/samples/sample_compare.eps

Note that "[~]$" is my command prompt. The command prompt on your system might appear different. Only type the part that comes after the prompt. I.e., type "cd" and press enter and next type "unzip GLE-4.0.12-src.zip" and press enter. Please feel free to contact the GLE mailing list if you experience any problems while installing GLE.

The unzip command above should have unzipped GLE to a folder called "gle4". Next we have to configure GLE. There are two options. If you know the root password of your system, then you can install GLE system wide (for all users). Alternatively, you may wish to install GLE in your home directory.

To install GLE system wide (in /usr/share/gle/x.y.z), enter the following commands.

[~]$ cd gle4/
[~/gle4]$ ./configure

To install GLE in your home directory, enter the following commands.

[~]$ cd gle4
[~/gle4]$ ./configure --prefix=$HOME/apps

The output of configure should look like this:

checking for g++... g++
checking for C++ compiler default output... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking whether byte ordering is bigendian... no
checking how to run the C++ preprocessor... g++ -E
checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
checking for XOpenDisplay in -lX11... yes
checking for deflate in -lz... yes
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for jpeg_destroy_decompress in -ljpeg... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for TIFFReadScanline in -ltiff... yes
checking tiffio.h usability... yes
checking tiffio.h presence... yes
checking for tiffio.h... yes
checking for libpng-config... no
checking for png_create_write_struct in -lpng... yes
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking for library containing wbkgdset... -lncurses
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/gle/Makefile
config.status: creating src/gle/bitmap/Makefile
config.status: creating src/gle/letzfitz/Makefile
config.status: creating src/gle/surface/Makefile
config.status: creating src/gle/tokens/Makefile
config.status: creating src/fbuild/Makefile
config.status: creating src/makefmt/Makefile
config.status: creating src/manip/Makefile
config.status: creating src/TeX/Makefile
config.status: creating src/gui/MakefileAC
config.status: creating src/config.h
config.status: src/config.h is unchanged

CPPFLAGS: -DHAVE_CONFIG_H $(VERSION_INFO) -Wreturn-type -I/usr/X11R6/include
LDFLAGS: -L/usr/X11R6/lib
LIBS: -lpng -ltiff -ljpeg -lz -lX11

** Configuration summary for GLE 4.0.12 (i686-pc-linux-gnu):

   ** Bitmap support:
      PNG support: yes
      TIFF support: yes
      JPEG support: yes

   ** X11 preview support: yes
   ** Socket support: yes
   ** Include 'manip' utility: yes

   ** GLE GUI support: no
      (make sure you have Qt >= 4.1.1 devel and use ./configure --with-qt=/path/to/qt.)

** Install data into: /home/jan/apps/share/gle/4.0.12
** Install binary into: /home/jan/apps/bin
   (use ./configure --prefix=dir to change the installation directory.)

GLE 4.0.12 has been configured. The next step is to run "make". After "make" completes, run "make install" to install GLE.

If you see some error messages instead, please contact the GLE mailing list. I will try to list the most common problems here based on your feedback.

Next enter the command "make" to compile GLE. This is the output on my system.

[~/gle4]$ make
mkdir -p build
mkdir -p build/bin
mkdir -p build/lib
make -C src/gle
make[1]: Entering directory `/home/jan/gle4/src/gle'
g++  -DHAVE_CONFIG_H -D__GLEVN__="\"4.0.12\"" -Wreturn-type -I/usr/X11R6/include  -c -o cutils.o cutils.cpp
g++  -DHAVE_CONFIG_H -D__GLEVN__="\"4.0.12\"" -Wreturn-type -I/usr/X11R6/include  -c -o file_io.o file_io.cpp
g++ -DHAVE_CONFIG_H -D__GLEVN__="\"4.0.12\"" -Wreturn-type -I/usr/X11R6/include setrelpath.cpp cutils.o file_io.o -o ../../build/bin/setrelpath
../../build/bin/setrelpath /home/jan/apps/bin /home/jan/apps/share/gle/4.0.12 ../config.h
Binary:   "/home/jan/apps/bin"
GLE_TOP:  "/home/jan/apps/share/gle/4.0.12"
Relative: "1"
Path:     "share/gle/4.0.12"
g++  -DHAVE_CONFIG_H -D__GLEVN__="\"4.0.12\"" -Wreturn-type -I/usr/X11R6/include  -c -o gle.o gle.cpp
**SNIP**
...
**SNIP**
[texcmssi.afm]==>[texcmssi.fmt]
../../build/bin/makefmt texcmsy.afm
[texcmsy.afm]==>[texcmsy.fmt]
../../build/bin/makefmt texcmti.afm
[texcmti.afm]==>[texcmti.fmt]
../../build/bin/makefmt texcmtt.afm
[texcmtt.afm]==>[texcmtt.fmt]
mkdir -p ../../build/font
cp *.fve *.fmt ../../build/font
cp font.dat ../../build/font
cp psfont.dat ../../build/font
touch movefonts
make[1]: Leaving directory `/home/jan/gle4/src/fonts'
make -C src/lib -f Makefile.gcc
make[1]: Entering directory `/home/jan/gle4/src/lib'
mkdir -p ../../build/lib
cp *.gle ../../build/lib/
make[1]: Leaving directory `/home/jan/gle4/src/lib'
make -C src/TeX
make[1]: Entering directory `/home/jan/gle4/src/TeX'
cp init.tex ../../build/
../../build/bin/gle -mkinittex
GLE 4.0.12 [/home/jan/gle4/build/init.tex]-C-R-
If GLE says 'Saving definitions', then compilation was successful.

>> /home/jan/gle4/build/init.tex (629) |end text|
Saving definitions

make[1]: Leaving directory `/home/jan/gle4/src/TeX'

**********************************************************
Type "make install" to install GLE 4.0.12
Install data into: /home/jan/apps/share/gle/4.0.12
Install binary into: /home/jan/apps/bin
**********************************************************

Next enter the command "make install" to install GLE. If you are installing system-wide, then you should enter "su" before running "make install" to install GLE as root. This is the output on my system.

rm -rf /home/jan/apps/bin/gle*
rm -rf /home/jan/apps/bin/manip*
**SNIP**
...
**SNIP**
cp -r build/lib /home/jan/apps/share/gle/4.0.12
cp build/bin/gle* /home/jan/apps/bin/
cp build/bin/manip* /home/jan/apps/bin/
strip /home/jan/apps/bin/gle*
strip /home/jan/apps/bin/manip*

****************************************************************
GLE 4.0.12 has been installed
You can use GLE now by entering the command "gle"
(Provided that /home/jan/apps/bin is in your PATH.)
****************************************************************

GLE should now be ready to use. Enter the command "gle" in your terminal to test it.

GLE version 4.0.12
Usage: gle [options] filename.gle
More information: gle -help

GLE should respond as in the example above. If you instead get the message "bash: gle: command not found", then the directory containing the "gle" executable is not in your system's search path. This is what happens if you have installed GLE in your home directory and "$HOME/apps/bin" is not in your path.

To fix this, enter "export PATH=$HOME/apps/bin:$PATH" and try again. Add this line to your "~/.bash_profile" file to make it permanent. Note: if this does not work, you can always start GLE using the full path, e.g., by entering the command "$HOME/apps/bin/gle".

Running GLE

GLE takes as input a script file containing GLE commands and outputs a graph or drawing, e.g., in PostScript or PDF format, which can be included in your LaTeX or OpenOffice document.

To create the script file we need a text editor. You may use any editor you like. Note that your editor should save files in UTF8 or ASCII format.

I will be creating my example GLE script file in the folder "GLE" in my home directory. Open your editor, type in the following GLE script, choose "Save" from the menu, create a new folder "GLE" in your home directory and save the file as "parabola.gle" in that folder.

size 12 8

begin graph
    let d1 = (x-2)^2 from 0 to 4 step 0.1
    d1 line color red
end graph

Next we are going to run GLE to create a PostScript ".eps" file from our script. In your terminal, enter the folldowing commands (replacing the argument of "cd" with the location where you saved "parabola.gle").

[~]$ cd GLE
[~/GLE]$ gle parabola.gle
GLE 4.0.12-rc1 [parabola.gle]-C-R-[parabola.eps]

GLE should respond as above. It has created the output file "parabola.eps".

[~/GLE]$ ls
total 10K
-rw-r--r-- 8.3K Jul 18 20:20 parabola.eps
-rw-r--r--   98 Jul 18 20:08 parabola.gle

To view "parabola.eps", we need a PostScript viewer like the program GhostView. Install GhostView on your system from your Linux DVD or package repository.

Viewing GLE's Output

After you have installed GhostView, enter the command "gv parabola.eps". If everyting went ok, then you will now see a preview of our parabola graph.

Try making changes to the GLE script in your editor, save it, rerun GLE, and preview in GhostView until you are satisfied with the output.

Try adding the following commands in the graph block of the GLE script.

title "Parabola"
xtitle "x"
ytitle "f(x) = (x-2)^2"

After running GLE, your output should include the title "Parabola" at the top of the graph and axis labels. Your graph is now ready for publication ;-).

Encapsulated PostScript (.eps) files are designed to be included as figures into other documents. If you want to print your file without including it in a larger document, tell GLE to create a regular PostScript (.ps) file instead. This can be done by running GLE with the "-d ps" option.

gle -d ps parabola.gle

Preview the resulting "parabola.ps" with GhostView. You will notice that the graph is now centered on a full page. Choose "File | Print" in GhostView to print it.

If you wish you can try running more examples from the GLE Example repository. You may also want to browse through the GLE documentation to learn more about writing GLE scripts.

Creating PDF, JPG, and PNG Output

GLE can create PDF, JPG, and PNG output by relying on GhostScript. GLE can use GhostScript if the "gs" executable is in your system's search path. This should normally be the case by default if you have installed GhostView.

We can now create PDF, JPG, and PNG output with the following commands.

gle -d pdf parabola.gle
gle -d jpg parabola.gle
gle -d png parabola.gle
gle -d pdf -fullpage parabola.gle

The command with the "-d pdf" and "-fullpage" options creates a full page PDF file with the parabola graph centered. This file can be printed with Adobe Reader.

The options "-d jpg" and "-d png" can be used in combination with "-dpi X", which changes the resolution of the resulting bitmap. Try, e.g., with "-dpi 75" and "-dpi 200".

Compiling the GLE Previewer QGLE

Starting from 4.0.12, GLE also has its own previewer called QGLE (written by A. S. Budden). Each time you run GLE with the "-p" option, QGLE will update its display. This is especially useful if you bind this command to a shortcut in your favorite editor.

To be able to use QGLE, it has to be compiled first. QGLE depends on the Qt library version 4.1.x or above. It will not compile with previous versions of Qt. You can download and install Qt from http://www.trolltech.com/. This requires compiling the library, which may take some time. Alternatively, a qt-devel package might be available for your Linux distribution.

Enter the following commands.

[~]$ cd gle4
[~/gle4]$ ./configure --prefix=$HOME/apps --with-qt=$HOME/apps/qt

And replace "$HOME/apps/qt" with the location of the Qt library on your system. This is the directory that has a subdirectory "bin", which includes the program "qmake". Note: you may be able to discover this location using the command "which qmake".

Make sure the output of "./configure" includes "** GLE GUI support: yes". This indicates that the Qt library was found. Now enter "make" and then "make install" to compile and install QGLE. Note: you can also compile GLE and QGLE at the same time with these commands.

Enter "qgle" or "$HOME/apps/bin/qgle" to start QGLE. The first time you run QGLE it will ask you for the location of "libgs.so". This is the GhostScript library, which might come with your GhostScript installation. It is usually located in "/usr/lib/libgs.so".

After "qgle" is running, enter the following commands.

[~]$ cd GLE
[~/GLE]$ gle -p parabola.gle

This will preview the output of "parabola.gle" in QGLE.