Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Matthias Griem - 07 Feb 2008 21:45 GMT
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
DBloke - 07 Feb 2008 21:58 GMT
Looks like a missing classpath problem from first sight, afraid I know
little about GCJ.

Hope this helps
DB
Matthias Griem - 07 Feb 2008 22:04 GMT
> Looks like a missing classpath problem from first sight, afraid I know
> little about GCJ.
>
> Hope this helps
no,

in the output below it shows, that both mail.jar and activation.jar are
found.
it must be something else which goes wrong.

8< snip:

>GNU Java version 4.2.1 (SUSE Linux) (i586-suse-linux)
>        compiled by GNU C version 4.2.1 (SUSE Linux).
[quoted text clipped - 4 lines]
>    /usr/share/java/libgcj-4.2.1.jar/ (system) (zip)
> /usr/lib/gcc/i58

8< snap:

thanks anyway ...

Matthias
DBloke - 07 Feb 2008 22:13 GMT
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
Matthias Griem - 07 Feb 2008 22:32 GMT
> Hi Matthias,
>
[quoted text clipped - 13 lines]
> --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
Lew - 08 Feb 2008 02:08 GMT
>> Hi Matthias,
>>
[quoted text clipped - 21 lines]
>
> any ideas?

Yes.  GCJ is lame and not compatible with Java.

Signature

Lew

Mark Space - 07 Feb 2008 22:32 GMT
>>GNU Java version 4.2.1 (SUSE Linux) (i586-suse-linux)
>>        compiled by GNU C version 4.2.1 (SUSE Linux).
[quoted text clipped - 6 lines]
>
> 8< snap:

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.
Matthias Griem - 07 Feb 2008 22:51 GMT
>>>GNU Java version 4.2.1 (SUSE Linux) (i586-suse-linux)
>>>        compiled by GNU C version 4.2.1 (SUSE Linux).
[quoted text clipped - 14 lines]
>
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.