The FLEX compiler emits code which must be linked against a Java
runtime environment and JNI implementation in order to make a complete
executable. The FLEX "Runtime" module provides these things. To
check it out, assuming you've already checked out the "Code" module
into ~/Harpoon/Code
:
% cd ~/Harpoon
% cvs -d `cat Code/CVS/Root` checkout Runtime
Note that there's no -r flag, as there is when you check out the Code module.
Unfortunately, CVS is broken. When you check out the Runtime like this, the garbage collector doesn't get checked out properly. Something is wrong with how CVS handles vendor tags. The following work-around (which you only have to do when checking out the Runtime from scratch) fixes the problem:
% cd ~/Harpoon/Runtime/Contrib/gc
% cvs update -r BOEHM_DIST
% cvs update -A
Ta-da.
Now read
~/Harpoon/Runtime/REQUIRED
to find out what other packages must be installed on your machine.
Use the --version
option to the program names mentioned in that
file to ensure that the versions on your machine are up-to-date.
Recent versions can be found at ftp.gnu.org
or
freshmeat.net
. Debian/unstable has recent-enough
versions of these tools, and I've been told that RedHat 8 does as
well.
If you are building applications for the StrongARM processor, you may need the arm-linux packages (ask Wes for them). If you are on a debian machine, installing cross-compilers is easy.
OK, now you're up to date. Doesn't that feel good? Run:
% cd ~/Harpoon/Runtime
% ./setup
to work some autoconf magic.
Now let's configure the runtime.
lists all the
options; there are a lot of them, and they can be fairly overwhelming.
./configure --help
For a runtime configured to work with the precise-c backend, good options are:
% ./configure --with-precise-c --with-gc=conservative \
--with-thread-model=heavy --disable-shared
After configuration, you'll want to actually build the sources:
% make
The runtime is installed and built!
The ~/Harpoon/Code/bin/build-precisec
script now ought to
leave a (working?) executable
in the Runtime directory when it's done whirring and clicking, like magic!
Here's a typical invocation, for 'Hello, World' in Hello.java:
% cd ~/Harpoon/Code
% javac -d . -g Hello.java
% bin/build-precisec Hello HI
This will create a directory of source files in
~/Harpoon/Code/asHI
, a library of
assembled source in ~/Harpoon/Runtime/HI-Java.a
(actually, it's automatically cleaned unless something goes wrong),
and an executable in
~/Harpoon/Runtime/runHI
.
Fun, huh?
Verbatim copying and distribution is permitted in any medium, provided this notice is preserved. |
cananian Last updated: 21 July 2003 |