A lightweight alternative to Java.



Supported platforms

Micro-libgcj is currently supported on the following platforms:

  Linux (i386 and amd64)
  Win32 (i386)
  Mac OS X (PPC)

Mac OS X (i386) can also be made to work.  However, as of this
writing, the Boehm GC library packaged with GCC does not support
Darwin (OS X) on the i386 architecture.  Until this is fixed, you can
substitute the latest upstream version, which does support this
platform.  See also

Other platforms may work, but have not been tested.

Applying the patch

To apply the patch included with this release (ulibgcj.patch), first
download gcc-4.1.1.tar.bz2 from one of the GCC mirrors listed at
http://gcc.gnu.org/mirrors.html and proceed as follows.

 $ tar xjf gcc-4.1.1.tar.bz2
 $ cd gcc-4.1.1
 $ patch -p1 < ../ulibgcj.patch

Building with micro-libgcj enabled

To build GCC with micro-libgcj enabled, specify --enable-micro-libgcj
in your configure command.  The following example assumes you have the
micro-libgcj-patched GCC source tree in a directory called gcc-ulibgcj
and that you are building within a sibling directory called gcc-build.

 $ cd gcc-build
 $ ../gcc-ulibgcj/configure \
  CFLAGS="-Os -g -fPIC" CXXFLAGS="-Os -g -fPIC" GCJFLAGS="-Os -g -fPIC" \
  --prefix=/usr/local/gcc-ulibgcj \
  --enable-languages=c,c++,java \
  --enable-threads \
  --disable-nls \
  --disable-shared \
  --disable-libstdcxx-debug \
  --disable-multilib \
  --without-libidn \
  --disable-tls \
  --without-x \
  --enable-java-gc=boehm \
  --enable-hash-synchronization \
  --disable-libgcj \
 $ nice make -j4
 $ make install

Note the --disable-shared argument to configure above.  This forces a
static libstdc++ to be built and used, which may be desirable if you
need to build standalone binaries which are immune to C++ ABI changes.
However, this does not currently work on Darwin (OS X), so you should
omit it on that platform.

If you are cross compiling with mingw32 as the target, replace the
above configure command with something like the following.  Here we
assume you have already installed the binutils, mingw-runtime, and
w32api packages from mingw.org into /usr/local/mingw32.

 $ ../gcc-ulibgcj/configure \
  CFLAGS="-Os -g" CXXFLAGS="-Os -g" GCJFLAGS="-Os -g" \
  --prefix=/usr/local/mingw32 \
  --target=mingw32 \
  --with-headers="/usr/local/mingw32/mingw32/include" \
  --enable-threads \
  --disable-nls \
  --enable-languages=c,c++,java \
  --disable-win32-registry \
  --disable-shared \
  --disable-libstdcxx-debug \
  --disable-multilib \
  --without-libidn \
  --disable-tls \
  --without-x \
  --enable-sjlj-exceptions \
  --enable-java-gc=boehm \
  --enable-hash-synchronization \
  --disable-libgcj \

Linking with micro-libgcj

Assuming you have a micro-libgcj-enabled build of gcc installed under
/usr/local/gcc-ulibgcj, the following example should produce a binary
which is statically linked to libulibgcj.a:

 $ /usr/local/gcc-ulibgcj/bin/gcj --main=Hello Hello.java -o hello

Dynamic linking is not currently supported, but could probably be made
to work without too much trouble.


Building micro-swt

Thanks for trying micro-swt.  The build system is quite rough at this
point, so it's not for the inexperienced, but hopefully the following
should help you get it working.  Note that you must already have
micro-libgcj built and installed before proceeding.  Here we assume
you've installed it under /usr/local/gcc-ulibgcj.

The current build system consists of a makefile and a Perl script
which generates dependencies based on the selected platform.
Supported platforms are listed below.

  lin64   (Linux/AMD64)
  lin32   (Linux/i386)
  osxppc  (OS X/PowerPC)
  osxi386 (OS X/i386)
  win32   (Windows/i386)

For example, to build the library on a Linux/AMD64 machine, use the

 $ make lin64=1

That should ultimately produce a file at build/lin64/swt.a, plus a
number of classes residing under build/lin64/classes/.  To compile and
link against these files, use something like the following:

 $ /usr/local/gcc-ulibgcj/bin/gcj -L/usr/local/gcc-ulibgcj/lib \
     -Wall -Os -g -fPIC --classpath=build/lin64/classes \
		--main=Hello test/Hello.java build/lin64/swt.a \
    $(pkg-config --libs-only-L cairo) -lcairo \
    $(pkg-config --libs-only-L gtk+-2.0 gthread-2.0) \
    -lgtk-x11-2.0 -lgthread-2.0 -L/usr/X11R6/lib -lXtst \
    $(pkg-config --libs-only-L atk gtk+-2.0) -latk-1.0 -lgtk-x11-2.0 \
    -L/usr/X11R6/lib -lGL -lGLU -lm -o build/lin64/hello

See the makefile for other examples, including platform-specific build
flags.  Those examples can be built as follows.

 $ make lin64=1 hello example graphics paint

Please note that you will need to edit the makefile by hand in some
cases based on your system configuration, unless it happens to match
mine exactly :).  Eventually, we'd like to adopt an automatic
configuration system using something like autoconf, but we haven't
reached that point yet.

Please also note that the makefile is currently set up to build the
win32 port via cross-development tools (ex. on a Linux host).  If you
wish to compile it on a Windows machine, you'll need to modify the
makefile accordingly.

SourceForge.net Logo
Valid XHTML 1.1