Table of Contents
This chapter is work in progress. Not all parts have been finished yet. The latest revision of this manual may contain more material. Refer to the online version.
Dryad is a collection of tools for developing transformation systems for Java source and bytecode.
For some applications, you might want to link with the Dryad library. This library has a few dependencies, such as libjvm, that make linking a bit more involved than it should be. Fortunately, you don't have to have to know all these details.
In an autoxt-based Automake package, you can use the variable
DRYAD_LIBS in the
Makefile.am. This variable contains all
the required linker flags, including platform specific ones.
At the command-line, the preferred way of compilation is:
$strc -i const-prop.str $(strcflags dryad java-front)
The strcflags include the Stratego includes (-I) of these packages and special linker options required to use the Dryad library. This way of compilation works on all supported platforms, since it reuses the information the configure script of Dryad has figured out about the platform you are running on.
If you haven't seen strcflags before: it is an alias for the invocation of pkg-config. You can define it using the following command. Of course, you also use the longer pkg-config variant in the invocation of strc.
$alias strcflags="pkg-config --variable=strcflags "
Make sure that Dryad is in the PKG_CONFIG_PATH. You can check if it is by invoking the following command. This will print a bunch of strc options. If it prints nothing, then dryad is not on the path and you can extend it by defining the PKG_CONFIG_PATH.
$echo $(strcflags dryad)
If you don't use the suggested ways of linking, then you probably get the following message:
$./const-prop -i Foo.java ./const-prop: error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory
This can be solved in several ways, for example by setting the
LD_LIBRARY_PATH, or by adding the runtime
path of the libjvm library to the executable. This is what is
done be the previously suggested solutions.
Dryad supports Mac OS X if the JDK 5.0 is installed. You need to configure 5.0 as the default JVM in the preferences, or you can set an environment variable for this:
If you get an
UnsupportedClassVersionError, then there
is something wrong with this configuration.
For Dryad, there is no need to manipulate the
symbolic links in
which is often suggested on the Internet. In fact, this will not
affect the default JVM at all for Dryad, which starts the JVM as
a library using JNI, not from the command-line.
Users of Dryad in Nix have to install the JDK 5.0 as well: it is not included in the dependencies of Dryad in Nix. They also have to configure this JDK as the default.
The JDK 5.0 is not officially supported on Mac OS X 10.3, but
the Java features Dryad uses work with an installation of JDK
5.0 on Mac OS X 10.3. For this, you can copy the installation
of the JDK on a Mac OS X 10.4 machine to Mac OS X 10.3. Copy
to Mac OS X 10.3 and create a symbolic link
to this directory. We advice you not to make this the global
default JVM: it is safer to set the
JAVA_JVM_VERSION to 1.5 for Dryad sessions
only, since the 1.5.0 installation will not work for most
other Java applications.