Compiling SWT application with GNU gcj
Michael Koch
konqueror@gmx.de
Tue Oct 11 10:55:00 GMT 2005
On Tue, Oct 11, 2005 at 11:39:48AM +0100, Andrew Haley wrote:
> Michael Koch writes:
> > On Mon, Oct 10, 2005 at 11:03:02PM +0200, Andrea wrote:
> > > Hi all,
> > > I'm trying to compile a simple SWT application (nothing more than a demo
> > > app) with gcj but I'm having some problems in the linking phase.
> > >
> > > This is what I do to compile:
> > >
> > > -----------------------------------
> > > nivox@host:~/Test/$ gcj -fjni -c --classpath=$SWT_HOME/swt.jar
> > > test/swt/Test.java
> > >
> > > nivox@host:~/Test/$ ls
> > > test Test.o
> > >
> > > nivox@host:~/Test/$ gcj --main=Test ./Test.o -lswt-gtk-3138
> > > /tmp/ccf5eyYv.o(.text+0x12): In function `main':
> > > : undefined reference to `_Jv_Compiler_Properties'
> > > /tmp/ccf5eyYv.o(.text+0x2b): In function `main':
> > > : undefined reference to `Test::class$'
> > > /tmp/ccf5eyYv.o(.text+0x30): In function `main':
> > > : undefined reference to `JvRunMain'
> > > ./Test.o(.text+0x10): In function `test::swt::Test::main(JArray*)':
> > > : undefined reference to `_Jv_InitClass'
> > > ./Test.o(.text+0x1f): In function `test::swt::Test::main(JArray*)':
> > > : undefined reference to `org::eclipse::swt::widgets::Display::class$'
> > > ./Test.o(.text+0x24): In function `test::swt::Test::main(JArray*)':
> > > : undefined reference to `_Jv_AllocObjectNoFinalizer'
> > > ./Test.o(.text+0x2e): In function `test::swt::Test::main(JArray*)':
> > > : undefined reference to
> > > `org::eclipse::swt::widgets::Display::Display[in-charge]()'
> > > ./Test.o(.text+0x42): In function `test::swt::Test::main(JArray*)':
> > > : undefined reference to `org::eclipse::swt::widgets::Shell::class$'
> > > ./Test.o(.text+0x47): In function `test::swt::Test::main(JArray*)':
> > > : undefined reference to `_Jv_AllocObjectNoFinalizer'
> > > ...
> > > -----------------------------------
> > >
> > > I have compiled with success a java program without graphic... so gcj is
> > > supposed to work properly.
> > >
> > > Gcj --version return this:
> > > gcj-4.0 (GCC) 4.0.0 20050301 (prerelease) (Debian 4.0-0pre6ubuntu7)
> > >
> > > I have the same problem on another machine with gcj 4.0.2 from Debian
> > > unstable (ppc).
> > >
> > > Have someone any hint for me?
> >
> > Make sure libgcj6-dev and libgcj-dev are installed. These are needed
> > when compiling to native (not when compiling to bytecode).
>> Oh dear. So, it's possible to install gcj but not libgcj when using
> Debian packaging. I wonder if perhaps we could make gcj spit out an
> error message when libgcj is missing, telling people that perhaps they
> need to install libgcj.
>> Otherwise we are going to see a *lot* of reports like this one.
We (in Debian) already have a lot of this. Perhaps we should consider
make gcj(-4.0) depending on libgcj(6)-dev instead of recommending it.
In Debian normal users are considered to install all recommends and only
not install them when you know what you are doing. The tools do this but
users are "smart" enough circumvent this ... :-(
Matthias: Are you considering a Depends: instead of a Recommends: ?
Cheers,
Michael
--
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
Join the community at http://planet.classpath.org/
More information about the Java
mailing list