Problems compiling Java-Prog with gcj using JavaMail (mail.jar) and JAF (activation.jar)

M

Matthias Griem

Hello,

i tried to compile a small Programm with gcj - no success :-( (using eclipse it works!!):

gcj --classpath=mail.jar:activation.jar -v --main=lantronix.mail.MailSender MailSender.java -o MailSender

Result:

Using built-in specs.
Reading specs from /usr/lib/gcc/i586-suse-linux/4.2.1/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.2.1 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --program-suffix=-4.2 --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=i586-suse-linux
Thread model: posix
gcc version 4.2.1 (SUSE Linux)
/usr/lib/gcc/i586-suse-linux/4.2.1/jc1 MailSender.java -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase MailSender.java -mtune=generic -auxbase MailSender -g1 -version -fclasspath=mail.jar:activation.jar -o /tmp/cclqviOf.s
GNU Java version 4.2.1 (SUSE Linux) (i586-suse-linux)
compiled by GNU C version 4.2.1 (SUSE Linux).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129464
Class path starts here:
mail.jar/ (zip)
activation.jar/ (zip)
/usr/share/java/libgcj-4.2.1.jar/ (system) (zip)
/usr/lib/gcc/i586-suse-linux/4.2.1/../../../../i586-suse-linux/bin/as -V -Qy -o /tmp/ccanivAm.o /tmp/cclqviOf.s
GNU assembler version 2.17.50 (i586-suse-linux) using BFD version (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux)
/usr/lib/gcc/i586-suse-linux/4.2.1/jvgenmain lantronix.mail.MailSendermain /tmp/ccXuLquw.i
/usr/lib/gcc/i586-suse-linux/4.2.1/cc1 /tmp/ccXuLquw.i -quiet -dumpbase lantronix.mail.MailSendermain.c -mtune=generic -g1 -version -fdollars-in-identifiers -o /tmp/cclqviOf.s
GNU C version 4.2.1 (SUSE Linux) (i586-suse-linux)
compiled by GNU C version 4.2.1 (SUSE Linux).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129464
Compiler executable checksum: d37fc6ca38af22df55d43dce99bbeccf
/usr/lib/gcc/i586-suse-linux/4.2.1/../../../../i586-suse-linux/bin/as -V -Qy -o /tmp/cchBffHx.o /tmp/cclqviOf.s
GNU assembler version 2.17.50 (i586-suse-linux) using BFD version (GNU Binutils) 2.17.50.20070726-14 (SUSE Linux)
/usr/lib/gcc/i586-suse-linux/4.2.1/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o MailSender /usr/lib/gcc/i586-suse-linux/4.2.1/../../../crt1.o /usr/lib/gcc/i586-suse-linux/4.2.1/../../../crti.o /usr/lib/gcc/i586-suse-linux/4.2.1/crtbegin.o -L/usr/lib/gcc/i586-suse-linux/4.2.1 -L/usr/lib/gcc/i586-suse-linux/4.2.1 -L/usr/lib/gcc/i586-suse-linux/4.2.1/../../../../i586-suse-linux/lib -L/usr/lib/gcc/i586-suse-linux/4.2.1/../../.. /tmp/cchBffHx.o /tmp/ccanivAm.o -lgcc_s -lgcc -lgcj -lm -lpthread -lrt -lz -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i586-suse-linux/4.2.1/crtend.o /usr/lib/gcc/i586-suse-linux/4.2.1/../../../crtn.o
/tmp/ccanivAm.o: In function `void lantronix::mail::MailSender::doSend()':
MailSender.java:(.text+0x108): undefined reference to `javax::mail::Session* javax::mail::Session::getDefaultInstance(java::util::properties*, javax::mail::Authenticator*)'
MailSender.java:(.text+0x141): undefined reference to `void javax::mail::Session::setDebug(bool)'
MailSender.java:(.text+0x148): undefined reference to `javax::mail::internet::MimeMessage::class$'
MailSender.java:(.text+0x177): undefined reference to `javax::mail::internet::MimeMessage::MimeMessage(javax::mail::Session*)'
MailSender.java:(.text+0x1a4): undefined reference to `javax::mail::internet::InternetAddress::class$'
MailSender.java:(.text+0x1d3): undefined reference to `javax::mail::internet::InternetAddress::InternetAddress(java::lang::String*)'
MailSender.java:(.text+0x220): undefined reference to `javax::mail::internet::InternetAddress::class$'
MailSender.java:(.text+0x24f): undefined reference to `javax::mail::internet::InternetAddress::InternetAddress(java::lang::String*)'
MailSender.java:(.text+0x27f): undefined reference to `javax::mail::Message$RecipientType::class$'
MailSender.java:(.text+0x28d): undefined reference to `javax::mail::Message$RecipientType::TO'
MailSender.java:(.text+0x303): undefined reference to `javax::mail::internet::InternetAddress::class$'
MailSender.java:(.text+0x326): undefined reference to `javax::mail::internet::InternetAddress::InternetAddress(java::lang::String*)'
MailSender.java:(.text+0x34a): undefined reference to `javax::mail::Message$RecipientType::class$'
MailSender.java:(.text+0x354): undefined reference to `javax::mail::Message$RecipientType::CC'
MailSender.java:(.text+0x425): undefined reference to `void javax::mail::Transport::send(javax::mail::Message*)'
MailSender.java:(.text+0x46a): undefined reference to `javax::mail::MessagingException::class$'
/tmp/ccanivAm.o:(.data+0xc4): undefined reference to `javax::mail::Session::class$'
/tmp/ccanivAm.o:(.data+0xd4): undefined reference to `javax::mail::Message::class$'
/tmp/ccanivAm.o:(.rodata+0x40): undefined reference to `javax::mail::MessagingException::class$'
collect2: ld returned 1 exit status
matthias@amax:~/workspace/zumTesten/src/lantronix/mail>

anyone with more experience using gcj ??


thanks for help

Matthias
 
D

DBloke

Matthias Griem wrote:
Looks like a missing classpath problem from first sight, afraid I know
little about GCJ.

Hope this helps
DB
 
D

DBloke

Hi Matthias,

Ok sorry I did notice one other thing I am not sure it is relevant but
below it looks like there is a disable flag for libgjc "--disable-libgcj"

not sure if this helps?

Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.2.1
--enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--program-suffix=-4.2 --enable-version-specific-runtime-libs
--without-system-libunwind --with-cpu=generic --host=i586-suse-linux
 
M

Mark Space

Matthias said:

It really does appear that there is a third .jar (at least) that is not
found:

MailSender.java:(.text+0x108): undefined reference to
`javax::mail::Session*


So MailSender can't find javax.mail.Seseion package.
 
M

Matthias Griem

DBloke said:
Hi Matthias,

Ok sorry I did notice one other thing I am not sure it is relevant but
below it looks like there is a disable flag for libgjc "--disable-libgcj"

not sure if this helps?

Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.2.1
--enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--program-suffix=-4.2 --enable-version-specific-runtime-libs
--without-system-libunwind --with-cpu=generic --host=i586-suse-linux


sorry, iforgot to mention that the usual 'HelloWorld' can be compiled and
run successfully.

there must be something else, probably compile/link the two jar-files
mail.jar and activation.jar

any ideas?

Matthias
 
M

Matthias Griem

Mark said:
It really does appear that there is a third .jar (at least) that is not
found:

MailSender.java:(.text+0x108): undefined reference to
`javax::mail::Session*


So MailSender can't find javax.mail.Seseion package.

it is for shure in 'mail.jar' - i checked it.
And the Program works fine using javac/java or Eclipse

so there must be something else ... gcj does not
find/use/compile/link ???...

thanks anyway

Matthias
 
L

Lew

Matthias said:
sorry, iforgot to mention that the usual 'HelloWorld' can be compiled and
run successfully.

there must be something else, probably compile/link the two jar-files
mail.jar and activation.jar

any ideas?

Yes. GCJ is lame and not compatible with Java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top