>Submitter-Id:  net
>Originator:    Colin Walters
>Organization:  
>Confidential:  no
>Synopsis:      gcj-3.0 fails to compile programs with package declaration
>Severity:      serious
>Priority:      medium
>Category:      java
>Class:         rejects-legal
>Release:       3.0.1 20010811 (Debian prerelease) (Debian testing/unstable)
>Environment:
System: Linux space-ghost 2.4.8-pre3+ipsec+xfs #3 Sun Aug 5 04:19:42 EDT 2001 
ppc unknown
Architecture: ppc

-- System Information
Debian Release: testing/unstable
Kernel Version: Linux space-ghost 2.4.8-pre3+ipsec+xfs #3 Sun Aug 5 04:19:42 
EDT 2001 ppc unknown

Versions of the packages gcj-3.0 depends on:
ii  gcc-3.0        3.0.1-0pre0108 The GNU C compiler.
ii  gcc-3.0-base   3.0.1-0pre0108 The GNU Compiler Collection (base package).
ii  java-common    0.7            Base of all Java packages
ii  libc6          2.2.3-6        GNU C Library: Shared libraries and Timezone
ii  libgcj2-dev    3.0.1-0pre0108 Java development headers and static library 
ii  zlib1g         1.1.3-15       compression library - runtime

host: powerpc-unknown-linux-gnu
build: powerpc-unknown-linux-gnu
target: powerpc-unknown-linux-gnu
configured with: ../src/configure -v 
--enable-languages=c,c++,java,f77,proto,objc --prefix=/usr 
--infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as 
--with-gnu-ld --with-system-zlib --enable-long-long --enable-nls 
--without-included-gettext --disable-checking --enable-threads=posix 
--enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc powerpc-linux
>Description:
 GCJ-3.0 fails to compile simple java programs whose main class
 file has a package declaration

>How-To-Repeat:

Here's a file Test.java:

,----[ Test.java ]
| package gnu.foo;
| 
| class Test {
|     public static void main(String[] args) {
|       System.out.println("Hello, World!");
|     }
| }
`----

Compiling it fails like:

,----[ *compilation** ]
| gcj-3.0 -o Test --main=Test Test.java
| /tmp/cctAs4jG.o: In function `main':
| /tmp/ccvuhFZz.i(.text+0x2e): undefined reference to `Test::class$'
| /tmp/ccvuhFZz.i(.text+0x32): undefined reference to `Test::class$'
| collect2: ld returned 1 exit status
`----

>Fix:
 If I remove the package declaration, everything seems to work
 fine.  I've experienced this with larger packages; I believe it's
 just having a package declaration in the file with the "main" function
 that causes a failure.


Reply via email to