The Open Source Software Project Based on IBM's Visualization Data Explorer
>
Home Page
Recent News
About OpenDX
Getting Started
Gallery-Highlights
Downloads
Add-Ons
Support
Support
Bookstore
The DX Community
Developers
Projects
Contributions
Contact Info
Advertising

©2002 OpenDX.org All rights reserved.


Compiling OpenDX

There are additional libraries that may be required to build a full working version of OpenDX. CDF, netCDF and HDF are data file format libraries. CDF and netCDF are required to run the samples and tutorial. Lesstif is a Motif implementation and may be necessary if your system does not have Motif libraries. Mesa3d is a graphics library which is necessary if there is not another GL library installed. ImageMagick is an image file format library (optional) that provides more export formats such as gif images. A java compiler and the java runtime environment are required for java-enabled dx (optional). You can find the libraries in the libraries section of these pages.

For additional help on getting all of the libraries compiled, we have provided a help page.

OpenDX uses the Gnu AutoConf tools for compiling and installation. The basic commands to do a compilation with all of the default behavior would be:

./configure

wait for configure to finish and the prompt to return

make

wait for make to finish and the prompt to return (this may take hours)

make install

This will install most of the package into /usr/local/dx and the dx executable file into /usr/local/bin

Nondefault Options

Installation Path

If you would like to end up installing OpenDX somewhere other than /usr/local, add the --prefix=/path2install option when configuring. For example to install into a user's home directory the configure may look like:

./configure --prefix=/u/home/david/

Libraries in nonstandard path

If you have installed extra libraries in a nonstandard path where the compiler will not find them, you can provide this information with the --x-includes and --x-libraries options. For example if you have installed the Mesa OpenGL libraries in a user's home directory, the configure may look like:

./configure --x-includes=/u/home/david/include/ \
--x-libraries=/u/home/david/lib/

The options provided can be a colon separated list if more than one is needed.

It is also possible to set the environment variables of LDFLAGS and CPPFLAGS into add path information. For example, some compilers do not default to look in fairly common directories. Add this information before running configure (using csh), like:

setenv CPPFLAGS -I/usr/local/include
setenv LDFLAGS -L/usr/local/lib

Not using gcc and g++ to compile

If you want or need to use a compiler other than gcc and g++, you can set some environment variables prior to running configure. The following are examples of setting the variables to use AIX's compilers using csh

setenv CC xlc; setenv CXX xlC

If you've already ran configure and you need to change the compilers, remove the config.cache file.

Options for compiling JavaDX

By default, running configure will do the following

Search for javac, jar, and javah - these must be in your path.

Check javac for usability - it must work.

Run a small program to locate the java root directory and look for include/jni.h and for jni_md.h in the architecture's include diretory. This has been updated to work with java 1.1.x and 1.2.x.

Check for a default installation of the jar files in /usr/lib/netscape/java/classes. The cosmo jar is not required and compilation can finish without it. Some functionality of models run with the Cosmo player may be lost.

These defaults can all be overridden two ways:

  1. Set environment variables for the hard to locate paths
    setenv JNIPATH /PathToDirectoryContaining-jni.h:/PathToDirectoryContaining-jni_md.h
    setenv COSMOJAR /PathToCosmoJarFile/cosmoFileName.jar
    setenv JAVA40JAR /PathToJava40JarFile/java40.jar

  2. And the highest precedence override is directly to configure
    --without-javadx (remove compilation altogether)
    --with-jni-path=/PathToDirectoryContaining-jni.h:/PathToDirectoryContaining-jni_md.h
    --with-cosmojar-path=/PathToCosmoJarFile/cosmoFileName.jar
    --with-java40jar-path=/PathToJava40JarFile/java40.jar

So, for example, if a user had some stuff set up in their home directory, the configure may have options like the following:

./configure --with-cosmojar-path=/u/home/david/npcosmop211.jar

C++ Compilation Problems

Some systems may have outdated X libraries (such as Solaris) and compiling with g++ gives an error so that compilation can not continue. You can tell g++ to be a little more forgiving by adding the -fpermissive flag to the compilation. The easiest way to do this is to set the CXXFLAGS environment variable prior to running configure:

setenv CXXFLAGS -fpermissive
./configure

Other platforms such as the SGI may have flags that need to be sent to the c++ compiler with the new header includes. These can be set on flags such as the preprocessor flags such as

setenv CPPFLAGS "-LANG:std"

ImageMagick Inclusion Problems

When configure runs, you can watch to see if ImageMagick will be included with your compile by watching for the ImageMagick checking section. If everything is okay, you will see a "yes" after the ImageMagick complete check. If not, you need to look at the config.log file after configure completes and try to determine what went wrong. For example on Solaris, it is possible that the compilation will pick up the OS's version of the TIFF library which is not as complete as the TIFF lib needed by ImageMagick. That being the case--it can be fixed easily by setting the following environment variable before configuring:

setenv CFLAGS -Lpath2realTIFFlib

Other Options

There are other options that can be passed to the configure script. If you are having problems configuring, try the help to list all options before seeking assistance. To get the help, do the following:

./configure --help

EXPLICIT EXAMPLE 1) gcc compiler and java on AIX

./configure --prefix=/u/res3/rpolson/OpenDX/DX4.0.10jx \
--with-x --x-includes=/u/res3/rpolson/OpenDX/include \
--x-libraries=/u/res3/rpolson/OpenDX/lib \
--includedir=/u/res3/rpolson/OpenDX/include \
--libdir=/u/res3/rpolson/OpenDX/lib \
--with-jni-path=/u/res3/rpolson/OpenDX/J1.1.8/:\
/u/res3/rpolson/OpenDX/J1.1.8/include:\
/u/res3/rpolson/OpenDX/J1.1.8/include/aix \
--with-java40jar-path=/tmp_mnt/home/aixlocal/ashare/\
libexec/netscape-4.61/java/classes/java40.jar 

After this configure, start the compilation with

make

There may be a complication at some point while compiling. An error with the message TOC (table of contents) is too big may be given. If this is the case, locate which directory was last being compiled. Open the Makefile in that directory with a text editor and the -mno-fp-in-toc flag

change : dxexec_LDFLAGS =  -bE:$(EXP)
to     : dxexec_LDFLAGS = -Xlinker -bE:$(EXP) -Xlinker -bbigtoc -mno-fp-in-toc

note: if in the middle of the make an error message that says
something like "gcc not found" appears, this really means that a flag
that is attempted to be passed to the linker has not been done
properly.  The likely fix is to go to the makefile in the directory
where the make fails and look at lines LDFLAGS. For the gcc compiler
to pass the flag properly it needs the additional flag "-Xlinker"
added before the linker flag.

Once compilation has completed, you are ready to install. Type:

make install

After installation, add /installpath/bin/ to your path environment variable. If you have chosen to install in a path other than the default, then you will need to set a few more environment variables before running the application.

setenv DXROOT /installpath/dx
setenv DXMACROS /installpath/dx/macros
setenv DATA /installpath/dx/data

EXPLICIT EXAMPLE 2) xlc compiler and java on AIX

setenv CC xlc
setenv CXX xlC

(note capitalization difference)

configure --prefix=/u/res3/rpolson/OpenDX/DX4.0.10xlcjx --with-x \
--x-includes=/u/res3/rpolson/OpenDX/include \
--x-libraries=/u/res3/rpolson/OpenDX/lib \
--includedir=/u/res3/rpolson/OpenDX/include \
--libdir=/u/res3/rpolson/OpenDX/lib \
--with-jni-path=/u/res3/rpolson/OpenDX/J1.1.8/:\
/u/res3/rpolson/OpenDX/J1.1.8/include:\
/u/res3/rpolson/OpenDX/J1.1.8/include/aix \
--with-java40jar-path=/tmp_mnt/home/aixlocal/ashare/\
libexec/netscape-4.61/java/classes/java40.jar 

make
make install

After installation, add /installpath/bin/ to your path environment variable. If you have chosen to install in a path other than the default, then you will need to set a few more environment variables before running the application.

setenv DXROOT /installpath/dx
setenv DXMACROS /installpath/dx/macros
setenv DATA /installpath/dx/data


Thanks to Randy Polson for a first draft of this document.
rpolson@mail.physics.utah.edu