PDA

View Full Version : GCJ & GCC, MingW



@nthony
09-11-2007, 02:28 PM
I've just recently heard of a GNU compiler tool called GCJ that can compile Java byte code into a target machine native language. After visiting the website (http://gcc.gnu.org/java/index.html) I am led to believe from the downloads section that GCJ is included with GCC. So my question is how does one invoke the GCJ compiler through GCC or MingW?

Perspective
09-11-2007, 02:40 PM
I'm not so sure it get's packaged with the default download of gcc, it's just part of the gcc project. The name of the executable is gcj and libgcj is the library. IIRC, it's linux only.

sept
09-11-2007, 03:21 PM
I am also interested in some experiences with gjc.

Is java then nearly fast as it would be written in C or C++?

From my understanding of the wiki article, gjc is currently only experimental. Isn`t fully compatible with jre and therefore not all librarys are working?

Sang-drax
09-11-2007, 03:34 PM
Is java then nearly fast as it would be written in C or C++?
It would still work a little differently, with garbage collection and such.

CornedBee
09-11-2007, 04:34 PM
Actually, I heard that GCJ has received so little attention that it is not very optimized; supposedly the native code generated by GCJ is slower than Sun's JVM.

sept
09-11-2007, 08:38 PM
Uhm, that`s worse. Then the only advantage is that you don`t need jre and save a lot of support querys that either jre is not installed or can not be installed for strange reasons.

Please split this if that`s going to much off topic.

What about the commercial java to native compilers? Are them better then jre (forget in meanwhile about portability)?

Frobozz
09-11-2007, 08:43 PM
The name of the executable is gcj and libgcj is the library. IIRC, it's linux only.
No it isn't. I've used it under MinGW just fine although I never did much with it. If you want it, just grab gcc-java-3.4.5-20060117-1.tar.gz (http://downloads.sourceforge.net/mingw/gcc-java-3.4.5-20060117-1.tar.gz?modtime=1137838971&big_mirror=1) and uncompress it into where mingw is.

@nthony
09-12-2007, 12:03 AM
awesome thanks!
Any links that corroborate the snag about compiled native code being less effecient than byte code/JVM?
Also, are there any other libraries/compilers that do the same thing? (JDK can't right?)

CornedBee
09-12-2007, 03:23 AM
Here's some numbers. This test looks extensive and rather fair:
http://www.shudo.net/jit/perf/

There is only one test where gcj beats the Sun JVM, and that's the Sieve of Eratosthenes. In all others, gcj is slower, sometimes by quite a margin.