public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcj and handling own packages question
@ 2004-01-13  9:19 Florian Weitling
  2004-01-13 12:28 ` Ranjit Mathew
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Weitling @ 2004-01-13  9:19 UTC (permalink / raw)
  To: gcc

Hi,

I tried compiling my own Java-Files to nate. They resided in directories
representing their packages, and I tried it with and without ".", "/" and
option "-I" and "classpath". Argh, didn't work.
Ok, next try: Stripped all imports and package in the files, deleted all
*.o (to be sure), put them all in one directory, compiled with

gcj -c -g -I . -O *java

worked! Tried to make an executable (forgot to say: actual Cygwin/WinXP)
with

$ gcj -I . --main=Anonymizer *.o
/Temp/cc7ATHYp.o(.text+0x39): In function `main':
/Temp/cc7qOYPg.i: undefined reference to `Anonymizer::class$'
collect2: ld returned 1 exit status

*sigh*

I had a long journey thru the net... but didn't find any worthy
explanation or tip.

Ciao,
Florian Weitling


	"Everything should be as simple as possible but no simpler."

                                Albert Einstein

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-13  9:19 gcj and handling own packages question Florian Weitling
@ 2004-01-13 12:28 ` Ranjit Mathew
  2004-01-13 18:39   ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Ranjit Mathew @ 2004-01-13 12:28 UTC (permalink / raw)
  To: gcc

Florian Weitling wrote:
> $ gcj -I . --main=Anonymizer *.o
> /Temp/cc7ATHYp.o(.text+0x39): In function `main':
> /Temp/cc7qOYPg.i: undefined reference to `Anonymizer::class$'
> collect2: ld returned 1 exit status

You haven't given much information and this might
sound "Duh!", but are you *sure* that you spelled
"Anonymizer" correctly for the class definition
inside the corresponding Java source file?

Does a simple "HelloWorld.java" program work
for you as expected with GCJ?

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-13 12:28 ` Ranjit Mathew
@ 2004-01-13 18:39   ` Tom Tromey
  2004-01-14 12:31     ` Florian Weitling
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2004-01-13 18:39 UTC (permalink / raw)
  To: Ranjit Mathew; +Cc: GCC Hackers, Florian Weitling

>>>>> "Ranjit" == Ranjit Mathew <rmathew@hotmail.com> writes:

Ranjit> Florian Weitling wrote:
>> $ gcj -I . --main=Anonymizer *.o
>> /Temp/cc7ATHYp.o(.text+0x39): In function `main':
>> /Temp/cc7qOYPg.i: undefined reference to `Anonymizer::class$'
>> collect2: ld returned 1 exit status

Ranjit> You haven't given much information and this might
Ranjit> sound "Duh!", but are you *sure* that you spelled
Ranjit> "Anonymizer" correctly for the class definition
Ranjit> inside the corresponding Java source file?

Another common problem in this area is not to use the fully qualified
class name.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-13 18:39   ` Tom Tromey
@ 2004-01-14 12:31     ` Florian Weitling
  2004-01-14 20:12       ` Andrew Haley
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Weitling @ 2004-01-14 12:31 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Ranjit Mathew, GCC Hackers


On Tue, 13 Jan 2004, Tom Tromey wrote:

> >>>>> "Ranjit" == Ranjit Mathew <rmathew@hotmail.com> writes:
>
> Ranjit> Florian Weitling wrote:
> >> $ gcj -I . --main=Anonymizer *.o
> >> /Temp/cc7ATHYp.o(.text+0x39): In function `main':
> >> /Temp/cc7qOYPg.i: undefined reference to `Anonymizer::class$'
> >> collect2: ld returned 1 exit status
>
> Ranjit> You haven't given much information and this might
> Ranjit> sound "Duh!", but are you *sure* that you spelled
> Ranjit> "Anonymizer" correctly for the class definition
> Ranjit> inside the corresponding Java source file?

Yes, of course: All files have been in use with JDK 1.4 from SUN.

> Another common problem in this area is not to use the fully qualified
> class name.

You mean, for class bla.blubb.Arf just say "Arf"? Tried that, too, didn't
work. The interesting fact here is, that it compiled the main class
"Anonymizer" and its companions, but doesn't find it for linking and
creating the executable. Hope I got it right...

One problem for me as I code regularly in Java not C/C++ is the lack of
simplicity. Sorry. I know that's not the main intention for gcj, but while
I have to type "javac bla.blubb.Arf.java" and all needed files are
compiled (yes, I know, no linking necessary...) as needed. And: For errors
I get at least a line number, although Java compilation errors are often
not selfexplaining, too.

But, I try to keep my esprit/elan :)
and if you still wish to help me...

Florian Weitling

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-14 12:31     ` Florian Weitling
@ 2004-01-14 20:12       ` Andrew Haley
  2004-01-15 17:46         ` gcj and handling own packages question - now the files! Florian Weitling
                           ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Andrew Haley @ 2004-01-14 20:12 UTC (permalink / raw)
  To: Florian Weitling; +Cc: Tom Tromey, Ranjit Mathew, GCC Hackers

Florian Weitling writes:
 > 
 > 
 > But, I try to keep my esprit/elan :)
 > and if you still wish to help me...

Well, does Hello, World work?

Andrew.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question - now the files!
  2004-01-14 20:12       ` Andrew Haley
@ 2004-01-15 17:46         ` Florian Weitling
  2004-01-15 17:48         ` gcj and handling own packages question Florian Weitling
  2004-01-22  6:48         ` Florian Weitling
  2 siblings, 0 replies; 12+ messages in thread
From: Florian Weitling @ 2004-01-15 17:46 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Tom Tromey, Ranjit Mathew, GCC Hackers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 362 bytes --]

Damn, I become old, here the files now!

	"Everything should be as simple as possible but no simpler."

                                Albert Einstein

On Wed, 14 Jan 2004, Andrew Haley wrote:

> Florian Weitling writes:
>  >
>  >
>  > But, I try to keep my esprit/elan :)
>  > and if you still wish to help me...
>
> Well, does Hello, World work?
>
> Andrew.
>

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2895 bytes --]

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ dir
total 1
-rw-r--r--    1 Florian  Kein          209 Jan 15 12:34 Hello.java
drwxr-xr-x    3 Florian  Kein            0 Jan 15 12:31 who

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj -c -g who/is/Knocking.java 

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ dir
total 7
-rw-r--r--    1 Florian  Kein          209 Jan 15 12:34 Hello.java
-rw-r--r--    1 Florian  Kein         5432 Jan 15 18:30 Knocking.o
drwxr-xr-x    3 Florian  Kein            0 Jan 15 12:31 who

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ cp Knocking.o who/is/

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj -c -g Hello.java 
Hello.java: In class `Hello':
Hello.java: In method `Hello.main(java.lang.String[])':
Hello.java:4: error: Undefined variable or class name: `who.is.Knocking'.
         who.is.Knocking.hearIt("damn tinnitus");
         ^
1 error

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj -c -g -I . Hello.java    

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ dir
total 11
-rw-r--r--    1 Florian  Kein          209 Jan 15 12:34 Hello.java
-rw-r--r--    1 Florian  Kein         3279 Jan 15 18:31 Hello.o
-rw-r--r--    1 Florian  Kein         5432 Jan 15 18:30 Knocking.o
drwxr-xr-x    3 Florian  Kein            0 Jan 15 12:31 who

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj --main=Hello Hello.o Knocking.o 
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/ccm65c4l.o(.text+0x39): In function `main':
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/ccYcecch.i: undefined reference to `Hello::class$'
collect2: ld returned 1 exit status

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj --main=Hello Hello.o who.is.Knocking.o 
gcj: who.is.Knocking.o: No such file or directory

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj --main=Hello Hello.o who/is/Knocking.o 
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/ccA18Fl2.o(.text+0x39): In function `main':
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/ccwv1Nk1.i: undefined reference to `Hello::class$'
collect2: ld returned 1 exit status

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj -I who/is --main=Hello Hello.o who/is/Knocking.o 
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/cclOgyLT.o(.text+0x39): In function `main':
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/ccbbH5r7.i: undefined reference to `Hello::class$'
collect2: ld returned 1 exit status

Florian@schlepptop ~/Eigene Dateien/jbproject/hallo
$ gcj -I who/is -I . --main=Hello Hello.o who/is/Knocking.o 
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/cczMJSrq.o(.text+0x39): In function `main':
/cygdrive/c/DOKUME~1/Florian/LOKALE~1/Temp/cchMsArc.i: undefined reference to `Hello::class$'
collect2: ld returned 1 exit status

[-- Attachment #3: Type: TEXT/PLAIN, Size: 136 bytes --]

package who.is;

public class Knocking {
  public static void hearIt (String someNoise) {
    System.out.println(someNoise);
  }
}

[-- Attachment #4: Type: TEXT/PLAIN, Size: 218 bytes --]

public class Hello {
  public static void main (String[] args) {
    if ( args.length == 0 ) {
      who.is.Knocking.hearIt("damn tinnitus");
    }
    else {
      who.is.Knocking.hearIt(args[0]);
    }
  }
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-14 20:12       ` Andrew Haley
  2004-01-15 17:46         ` gcj and handling own packages question - now the files! Florian Weitling
@ 2004-01-15 17:48         ` Florian Weitling
  2004-01-16  5:00           ` Ranjit Mathew
  2004-01-22  6:48         ` Florian Weitling
  2 siblings, 1 reply; 12+ messages in thread
From: Florian Weitling @ 2004-01-15 17:48 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Tom Tromey, Ranjit Mathew, GCC Hackers

Hi Folks,

with your several tips I tried and failed *sigh*, so I made a veeeery
simple example (attached as files Hello.java, which calls a method in
who.is.Knocking) and a shell excerpt to see what I typed. Maybe I got
something completely wrong.

Thanks for your help (once more :)

Florian

On Wed, 14 Jan 2004, Andrew Haley wrote:

> Florian Weitling writes:
>  >
>  >
>  > But, I try to keep my esprit/elan :)
>  > and if you still wish to help me...
>
> Well, does Hello, World work?
>
> Andrew.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-15 17:48         ` gcj and handling own packages question Florian Weitling
@ 2004-01-16  5:00           ` Ranjit Mathew
  0 siblings, 0 replies; 12+ messages in thread
From: Ranjit Mathew @ 2004-01-16  5:00 UTC (permalink / raw)
  To: Florian Weitling; +Cc: GCC Hackers

Florian Weitling wrote:
> with your several tips I tried and failed *sigh*, so I made a veeeery
> simple example (attached as files Hello.java, which calls a method in
> who.is.Knocking) and a shell excerpt to see what I typed. Maybe I got
> something completely wrong.
> 
> Thanks for your help (once more :)

You don't mention the exact version of GCJ/GCC that
you're using, but in any case it is quite
broken/ancient.

I tried your example as is with GCJ 3.4
snapshot for Windows as found (for example)
in:

    http://www.thisiscool.com/gcc_mingw.htm

on Windows 2000 without encountering any
problems.

The GCJ binaries available from the link
given above work as normal Win32 executables
and do not need Cygwin - if you insist on
using them from within Cygwin, do ensure that
they come before Cygwin's GCC/GCJ in your PATH.

Do try it out and let us know if you still
face any problems.

HTH,
Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-14 20:12       ` Andrew Haley
  2004-01-15 17:46         ` gcj and handling own packages question - now the files! Florian Weitling
  2004-01-15 17:48         ` gcj and handling own packages question Florian Weitling
@ 2004-01-22  6:48         ` Florian Weitling
  2004-01-26 16:11           ` Tom Tromey
  2 siblings, 1 reply; 12+ messages in thread
From: Florian Weitling @ 2004-01-22  6:48 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Tom Tromey, Ranjit Mathew, GCC Hackers

Hello,

did you receive my last eMail containing two example classes and a
type-in-trail? Did you find an answer?

Thanks,
Florian

On Wed, 14 Jan 2004, Andrew Haley wrote:

> Florian Weitling writes:
>  >
>  >
>  > But, I try to keep my esprit/elan :)
>  > and if you still wish to help me...
>
> Well, does Hello, World work?
>
> Andrew.
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-22  6:48         ` Florian Weitling
@ 2004-01-26 16:11           ` Tom Tromey
  2004-01-26 18:16             ` Florian Weitling
  2004-02-02 19:26             ` Florian Weitling
  0 siblings, 2 replies; 12+ messages in thread
From: Tom Tromey @ 2004-01-26 16:11 UTC (permalink / raw)
  To: Florian Weitling; +Cc: Andrew Haley, Ranjit Mathew, GCC Hackers

>>>>> "Florian" == Florian Weitling <weitling@informatik.uni-freiburg.de> writes:

Florian> did you receive my last eMail containing two example classes and a
Florian> type-in-trail? Did you find an answer?

What you did looked reasonable to me offhand.
Can you try "nm Hello.o" and see what that says?

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-26 16:11           ` Tom Tromey
@ 2004-01-26 18:16             ` Florian Weitling
  2004-02-02 19:26             ` Florian Weitling
  1 sibling, 0 replies; 12+ messages in thread
From: Florian Weitling @ 2004-01-26 18:16 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andrew Haley, Ranjit Mathew, GCC Hackers

On Mon, 26 Jan 2004, Tom Tromey wrote:

> >>>>> "Florian" == Florian Weitling <weitling@informatik.uni-freiburg.de> writes:
>
> Florian> did you receive my last eMail containing two example classes and a
> Florian> type-in-trail? Did you find an answer?
>
> What you did looked reasonable to me offhand.
> Can you try "nm Hello.o" and see what that says?
>
> Tom

Typed that mystic order and got:

00000000 b .bss
00000000 d .ctors
00000000 d .data
00000000 N .stab
00000000 N .stabstr
00000000 t .text
00000000 t __GLOBAL__I_.CsQGxb
00000000 b _otable_syms

Are that many 0's good (damn, as Java programmer I should better shut up ;)

Florian

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: gcj and handling own packages question
  2004-01-26 16:11           ` Tom Tromey
  2004-01-26 18:16             ` Florian Weitling
@ 2004-02-02 19:26             ` Florian Weitling
  1 sibling, 0 replies; 12+ messages in thread
From: Florian Weitling @ 2004-02-02 19:26 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andrew Haley, Ranjit Mathew, GCC Hackers

Hi Tom & Co.,

sorry, if I am permanently penetrant, but did my last reply to your mail
arrive and help?

Thank you very much and greetings from Germany,
Florian


On Mon, 26 Jan 2004, Tom Tromey wrote:

> >>>>> "Florian" == Florian Weitling <weitling@informatik.uni-freiburg.de> writes:
>
> Florian> did you receive my last eMail containing two example classes and a
> Florian> type-in-trail? Did you find an answer?
>
> What you did looked reasonable to me offhand.
> Can you try "nm Hello.o" and see what that says?
>
> Tom
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-02-02 19:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-13  9:19 gcj and handling own packages question Florian Weitling
2004-01-13 12:28 ` Ranjit Mathew
2004-01-13 18:39   ` Tom Tromey
2004-01-14 12:31     ` Florian Weitling
2004-01-14 20:12       ` Andrew Haley
2004-01-15 17:46         ` gcj and handling own packages question - now the files! Florian Weitling
2004-01-15 17:48         ` gcj and handling own packages question Florian Weitling
2004-01-16  5:00           ` Ranjit Mathew
2004-01-22  6:48         ` Florian Weitling
2004-01-26 16:11           ` Tom Tromey
2004-01-26 18:16             ` Florian Weitling
2004-02-02 19:26             ` Florian Weitling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).