(Previous | Contents | Next)

## Compiling LAMARC

We provide executables of LAMARC for many systems, but if you cannot use these, or wish to compile the program yourself, we provide source code as well. This article discusses our experience compiling LAMARC. We welcome your comments on the use of other compilers and computing environments.

LAMARC is written in C++. We tried to avoid advanced or new features of the language, but very old compilers will probably not work. We recommend the use of GNU g++ on any machine which supports it; this is the compiler we used to develop LAMARC, and it works well on most systems.

### Compilation and Testing of Released Executables

Here is a list of machine/compiler combinations we have tried, with comments on our success or lack of it.

OS Family | Compiler Used | Compiled On | Tested On | Notes
Linux | GNU g++ 4.1.2 | debian 2.6.17.3.emp3 kernel 32 bit i686 | Our code should compile on any Linux- or Unix-based system. If you are using a compiler other than g++, the GNU C++ compiler, you may need to give our configure script and makefiles some extra help Previous releases have successfully compiled on 64 bit debian machines, but we did not have one at our disposal for this release.
GNU g++ 3.4.2 | red hat 2.4.21-47 kernel 32 bit i686 | GNU g++ 4.1.2 | debian 2.6.18-4 kernel 32 bit i686

Windows

MinGW cross compile from Linux
GNU g++ 3.4.2
MinGW runtime 3.7
w32 API 3.2

red hat
2.4.21-47 kernel
32 bit

Windows XP
32 bit

We create our Windows executables by cross compiling from Linux using the Mingw tools. Compiling directly on a windows box should therefore work well under the Mingw or Cygwin tool sets using g++, though we have not tested this ourselves.
If the compiler you use expects you to explicitly set the heap size, you may need to set it to be quite large in order to run the program on an interesting data set.

MacOS X | GNU g++ 4.0.1 | intel-mac | intel-mac | As of Lamarc version 2.0, we have stopped supporting the Mac OS 9 platform. We compile and distibute our OS X binary as a single universal binary, which runs on both Intel macs and PowerPC macs. If you're compiling your own copy, you probably don't need to do that. The wxWidgets code will not compile with g++ 4.0.0.
ppc

### Basic Instructions for Compiling and Installing LAMARC on *-nix Systems

Here are basic instructions for compiling on Linux/Unix/Mac OSX systems.

Begin by un-taring the distribution and creating a sub-directory to compile in. This will keep your object files from cluttering up a listing of the top level of the distribution.

        tar xfvz lamarc-2.1.3.src.tar.gz
        cd lamarc-2.1.3
        mkdir release
        cd release

The configure script queries your system and produces a Makefile tailored to your computing environment. Try invoking it like this:

        ../configure

or, if that doesn't work, like this:

        sh ../configure

The configure script will probably complain that you don't have wxWidgets installed. (wxWidgets is a free, open source toolkit for GUI applications. Through it, we provide native look-and-feel Linux, Mac OS X, and Windows GUI interfaces to our file converter using a single code base.) If you already have wxWidgets, you can invoke `configure` like this:

        sh ../configure --with-wxconfig=/path/to/wx-config

If you don't have wxWidgets, or your current version is too old, the following invocation should build a wxWidgets distribution for you. (Be warned that this may take some time.)

        ../configure --enable-buildwx

If none of these variations for invoking the configure script worked for you, skip ahead to Advanced Configuration Options.

You are now ready to make lamarc. (It is recommended that you use the GNU make utility. On some systems it may be called gmake.)

        make

This will produce executables lamarc and lam_conv if you're running on a Unix or Linux system. If you're running under Mac OS X, you should get clickable executables.

To install the executables and html documentation (you may need sysadmin privilidges to do this, and it is not required to use the program) type either

        make install

or

        make install-strip

Either of these should install the executables in /usr/local/bin and the documentation under /usr/local/html/lamarc. Executables installed either way have the same compute time performance. The install-strip versions are smaller but provide no debugging information, should you run into problems.

### Advanced Configuration Options

For most users, the configure script provided with the distribution should work as described above. However, there are several situations in which you may wish to change the behavior of the configure script. These include when:

- the configure declares it cannot proceed without LAMARC_CODE_OSTYPE,
- the configure declares it cannot proceed without GUI_TOOLKIT, or
- you wish to use a non-default compiler, or override variables such as CXXFLAGS and LDFLAGS.

If these techniques are not adequate to solve your problems, you may wish to:

- compile a batch only version of the lamarc converter,
- default to an ancient version of the lamarc converter, or
- edit the configure script and Makefile yourself.

#### Setting LAMARC_CODE_OSTYPE

While most of the lamarc code is not dependent on the user's operating system, there are a few minor differences in I/O handling and standard library headers. These differences require the setting of the variable LAMARC_CODE_OSTYPE so that appropriate code can be exercised for each operating system.

Under normal circumstances, the configure script should be able to guess the correct value for LAMARC_CODE_OSTYPE. If it cannot, you may set the value by including an assignment to it when you invoke the configure script. For example

        ../configure LAMARC_CODE_OSTYPE=LAMARC_COMPILE_MACOSX
        make

The assignment to LAMARC_CODE_OSTYPE should come after any other arguments to the configure script, for example:

        ../configure --enable-debug LAMARC_CODE_OSTYPE=LAMARC_COMPILE_LINUX
        make

Legal values for LAMARC_CODE_OSTYPE are:

- LAMARC_COMPILE_LINUX
- LAMARC_COMPILE_MACOSX
- LAMARC_COMPILE_WINDOWS

#### Setting GUI_TOOLKIT

Under normal circumstances, the configure script should be able to guess the correct value for GUI_TOOLKIT. If it cannot, or you wish to use a different toolkit, you should set the value for GUI_TOOLKIT. As with setting LAMARC_CODE_OSTYPE, the assignment is made at the end of the invocation of configure. For example:

        ../configure GUI_TOOLKIT=gtk2
        make

The assignment to GUI_TOOLKIT should come after any other arguments to the configure script, and is most likely to be needed when you are also setting LAMARC_CODE_OSTYPE. For example:

        ../configure --enable-debug LAMARC_CODE_OSTYPE=LAMARC_COMPILE_MACOSX GUI_TOOLKIT=mac
        make

Tested values for GUI_TOOLKIT are:

- gtk2 -- tested on linux systems
- mac -- tested on OS X systems
- msw -- tested on a Windows system

It is possible that other toolkit values supported by wxWidgets work, including x11, Motif, and OS/2. If you wish to build for one of these toolkits, we suggest you start with wxWidget's information on supported platforms (http://www.wxwidgets.org/docs/platform.htm).

#### Specifying non-standard compiler and/or build flags

The configure script is designed to allow you to specify a compiler or to pass options to the compiler or preprocessor. For example, if you are testing out a new C++ compiler you might invoke it like this:

        ../configure CXX=/path/to/my/compiler CXXFLAGS="I /path/to/my/include/files"
        make

For more information on options and environment variables that effect the configure script type

        ../configure --help

#### Compiling a batch only version of the converter

If you cannot successfully build for any GUI_TOOLKIT, or if you wish to run the lamarc file converter as part of a batch process, you can build a batch only version of the converter with the following commands (add CXX and CXXFLAGS, etc at the end if you need them):

        ../configure --disable-gui --enable-buildwx
        make

#### Compiling a wxWidgets-less converter

We recommend the following step only as a last resort. If you are going to attempt it, we recommend that you email us at lamarc@gs.washington.edu. to make sure there isn't a better solution.

If you unable to build wxWidgets at all (and therefore not have access to the converter) you may instead configure and make as follows:

        ../configure --disable-converter
        make old_lam_conv
        make

You must explicitly give the argument to "make old_lam_conv" -- it will not otherwise be built. Please be warned that old_lam_conv is no longer maintained and will not have all features of the new converter.

#### Editing the configure script and Makefile yourself

If none of the above techniques allows you to build the lamarc programs, you have one further option -- edit the configure script and Makefiles yourself.

The easiest way to do this is to edit them the same way we do, using autoconf and automake. These tools are available at the following locations:

- http://www.gnu.org/software/autoconf
- http://www.gnu.org/software/automake

You may also wish to read additonal documentation available at

- http://sources.redhat.com/autobook/
- http://seul.org/docs/autotut/

Make any edits you need to Makefile.am or configure.ac and then issue the following series of commands

        aclocal
        autoconf
        autoheader
        automake --add-missing

You may then proceed to configure and make as in the section Basic Instructions... above.

(Previous | Contents | Next)