GLE Compilation Guide

This tutorial explains how to compile GLE from its source code using the GCC compiler. The tutorial covers compilation on the following operation systems:

Windows
GNU/Linux

Instructions relevant to a particular OS are marked with the corresponding icon.

Please feel free to contact the GLE mailing list if you experience any problems while compiling GLE. Also, please contact the list if you find that some information on this page is outdated, incorrect, or missing.

Required Software

Development Tools

To compile GLE on Windows with GCC, you need a Windows port of GCC, "make", and other Unix-like tools. There are two options: MinGW/MSYS and Cygwin. GLE compiles fine with both systems. In this tutorial I will focus on Cygwin. Download Cygwin's "Setup.exe" from this location and double click it in Explorer. This will guide you through Cygwin's installation process. After asking you, among others, to select a download mirror, Cygwin's setup will show you a list with all software packages that can be installed. It is best to keep all packages that are selected by default. In addition, make sure that the following packages are selected:
  • Archive/unzip
  • Archive/zip
  • Devel/autoconf
  • Devel/automake
  • Devel/pkg-config
  • Devel/gcc-core
  • Devel/gcc-g++
  • Devel/gcc-mingw-core
  • Devel/gcc-mingw-g++
  • Devel/make
  • Devel/mingw-runtime
  • Libs/w32api
  • Interpreters/perl
Then proceed with the Cygwin install. I'll assume that you install Cygwin in "C:\Devel\Cygwin". Cygwin's installer will add an entry labeled "Cygwin Bash Shell" in a folder named "Cygwin" to your Start Menu. Click this entry to start the Bash command prompt (later also called "terminal window"). All commands discussed next should be entered here.

To compile GLE on Linux with GCC, you need the GNU build tools GCC and "make". In many cases, these are installed by default. To find out, enter the command "g++ --version" in a terminal window ("Gnome Terminal" on Gnome, or "Konsole" on KDE). If this prints "bash: g++: command not found", then GCC is not installed. Try the same with "make". If GCC or make is missing, then check your Linux distribution's software package repository and install the packages for "g++", "gcc", "make", and "libc-devel". On Ubuntu, all these packages can be installed at once with the command "sudo apt-get install build-essential".

I'm using the following versions of GCC and make (newer versions also work):

[~]$ g++ --version
g++ (GCC) 3.3.5 (Debian 1:3.3.5-13)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[~]$ make --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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 "g++ --version" and then press enter and next type "make --version" and press enter. In the following, I assume basic familiarity with Bash and simple Unix commands.

Optional Software Packages

This section lists a number of software packages that are optional, but recomended. That is, GLE will compile without these packages, but it will lack certain features.

On Windows you obtain the optional software packages as follows:
  • Download and install the "Qt/Windows Open Source Edition" from the QT website. This version is free software and licensed under the GPL. (There are also commercial versions of Qt). To find the download from Qt's main page, first click "Developer Zone", then "Downloads", then "Qt", and then scroll down to "Qt Open Source Downloads". This tutorial assumes that you install Qt in "C:\Devel\Qt4".
     
  • Download and install "GPL GhostScript" from the GhostScript website. The windows installer is named "gsXYZw32.exe" with XYZ the version number. It is also useful to install "GSview" (GhostScript's PostScript/EPS viewer) from the same location. This tutorial assumes that you install GhostScript in a subfolder of "C:\Program Files".
     
  • Download and install "LaTeX" from the MiKTeX website. This tutorial assumes that you install MikTeX in a subfolder of "C:\Program Files".
     
  • Download and install the bitmap libraries. I've made a ZIP archive file containing libtiff, libpng, and libjpeg: bitmap-win32-v1.0.zip. Download this ZIP file and extract it to "C:\Devel\bitmap-win32". If you don't have WinZip, then save the ZIP file to your Cygwin home directory and type at the Cygwin Bash prompt:
     
    [~]$ mkdir -p c:/Devel
    [~]$ cd c:/Devel
    [~]$ unzip ~/bitmap-win32-v1.0.zip
    

The optional software packages should all be included in your Linux distribution's package repository. You should be able to find and install them by searching the repository for the package names (i.e., "qt4", "libtiff", "libpng", ...). If, for a given package, a version is available with "devel" or "dev" in the name, then install that version. The "devel" packages typically include the "C" header files of the library, which are required to compile GLE.

The following are the appropriate commands to install all of the optional software packages on some well known Linux distributions:

Please contact the mailing list (or contact Jan Struyf directly) to share the appropriate command for your Linux distribution.

QGLE requires the file "libgs.so". Normally this file should be part of GhostScript. If your distribution does not include "libgs.so" in its GhostScript package, then download gs8.54-linux.zip and extract it in your home directory, or somewhere under "/usr" (as root). This ZIP file contains a GhostScript binary that includes "libgs.so". To check if you have "libgs.so" or not, become root ("su" or "sudo bash") and type the following commands:
 
[~]$ updatedb
[~]$ locate libgs.so

Download and Unzip GLE

Download GLE's source code archive GLE-x.y.z-src.zip (with x.y.z the version number) from the download page and save it to your home directory. Open a terminal or console window and unzip the archive with the following commands.

[~]$ cd
[~]$ unzip GLE-x.y.z-src.zip
Archive:  GLE-x.y.z-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

The unzip command above should have unzipped GLE to a subfolder of your home directory called "gle4".

Configure GLE's Source Code

Next we have to configure GLE's source code. During this step, various compilation options for GLE can be set. In many cases, however, the defaults should be fine. To configure GLE using the default settings, run the "configure" script in the "gle4" directory as follows.

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

On Linux, the default is to install GLE system wide in /usr/share/gle/x.y.z (for all users). You will need the root password of your system to do this. Alternatively, you may wish to install GLE in your home directory. To do so, use the "--prefix" option of configure as follows.

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

On Windows, the default is to build a Cygwin executable. In order to create a native Windows executable, which can run on non-Cygwin systems, add the configure option "--with-win32=yes". This option is also required if you wish to build QGLE. If you downloaded the bitmap libraries mentioned above (bitmap-win32-vx.y.zip) then you indicate this with the option "--with-gnuwin32=c:/Devel/bitmap-win32", and if you have Qt installed, then you add "--with-qt=c:/Devel/Qt4".

[~/gle4]$ ./configure --with-win32=yes --with-gnuwin32=c:/Devel/bitmap-win32 --with-qt=c:/Devel/Qt4

The output of configure should look similar to 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 x.y.z (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/x.y.z
** Install binary into: /home/jan/apps/bin
   (use ./configure --prefix=dir to change the installation directory.)

GLE x.y.z 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.

Compile GLE's Source Code

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__="\"x.y.z\"" -Wreturn-type -I/usr/X11R6/include  -c -o cutils.o cutils.cpp
g++  -DHAVE_CONFIG_H -D__GLEVN__="\"x.y.z\"" -Wreturn-type -I/usr/X11R6/include  -c -o file_io.o file_io.cpp
g++ -DHAVE_CONFIG_H -D__GLEVN__="\"x.y.z\"" -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/x.y.z ../config.h
Binary:   "/home/jan/apps/bin"
GLE_TOP:  "/home/jan/apps/share/gle/x.y.z"
Relative: "1"
Path:     "share/gle/x.y.z"
g++  -DHAVE_CONFIG_H -D__GLEVN__="\"x.y.z\"" -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 x.y.z [/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 x.y.z
Install data into: /home/jan/apps/share/gle/x.y.z
Install binary into: /home/jan/apps/bin
**********************************************************

Install GLE

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/x.y.z
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 x.y.z 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 x.y.z
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".

Run GLE

Running GLE is covered in the following documents:

Please feel free to contact the GLE mailing list if you have any feedback regarding this compilation guide.