The GCC 3.3 / MingW Cross Compiler Seems to Work! Woo hoo!

Mohan Embar
Fri Feb 14 14:15:00 GMT 2003

Ranjit>  Thank you, but in all fairness, I must point out that it has got
Ranjit> nothing to do with that patch - see libjava/
Ranjit> ------------------------------- 8< -----------------------------------
Ranjit> # Only use libltdl for native builds.
Ranjit> if test -z "${with_cross_host}"; then
Ranjit> ...
Ranjit> ------------------------------- 8< -----------------------------------
Ranjit> For a crossed-native build, host==target and with_cross_host is
Ranjit> therefore not defined.
Ranjit> However, I do not understand why libltdl should not be built
Ranjit> while building a cross-compiler - the compiled binaries are
Ranjit> ultimately anyway going to run on the target...

Following this line of reasoning (Frank had pointed this out too), I commented
out these lines in libjava/configure:

# Only use libltdl for native builds.
if test -z "${with_cross_host}"; then

reconfigured and rebuilt gcc, and... JNI worked in the cross-compiler!
My cross-compiled SWT HelloWorld samples worked too! Woo hoo!

(I know I was supposed to fix and regenerate configure.
Haven't a clue as to how to do this yet. At this point, I only have an
inkling as to what automake and autoconf are. I'll have to read up
on all this.)

To summarize, I followed Lars' build tips plus the above configure hack

modified the SWT build script from:

and built a GCC/GCJ cross compiler for MingW. For those of you who just
joined us, I am only dealing with the cross compiler (Linux to Win32/MingW)
at this point, not the crossed-native compiler (Win32/MingW to Win32/MingW).

What's more, all of the examples worked!, including my faulty which sucked me into this fun, complex, scary maelstrom
in the first place:

I'll do a more thorough writeup on this later.

Next steps:
- take Ranjit's new Win32 Process implementation out for a spin.
  I need this too for what I'm trying to do.
- attempt to build the crossed-native compiler

Thanks again to everyone for all your guidance and encouragement.

-- Mohan

More information about the Java mailing list