From owner-freebsd-java Mon Oct 8 14: 4: 6 2001 Delivered-To: freebsd-java@freebsd.org Received: from penfold.transactionware.com (penfold.transactionware.com [203.14.245.1]) by hub.freebsd.org (Postfix) with SMTP id 3ABDC37B40A for ; Mon, 8 Oct 2001 14:03:59 -0700 (PDT) Received: (qmail 68211 invoked from network); 8 Oct 2001 21:03:54 -0000 Received: from ck.transactionware.com (192.168.1.17) by penfold.transactionware.com with SMTP; 8 Oct 2001 21:03:54 -0000 Received: (qmail 12355 invoked by uid 1006); 8 Oct 2001 21:09:54 -0000 Received: from janm@transactionware.com by ck.transactionware.com with qmail-scanner-0.96 (sweep: 2.4/3.46. . Clean. Processed in 1.424382 secs); 08 Oct 2001 21:09:54 -0000 Received: from du1.transactionware.com (HELO mosm1) (192.168.1.10) by ck.transactionware.com with SMTP; 8 Oct 2001 21:09:52 -0000 Message-ID: <013201c1503c$9b13f200$0a01a8c0@mosm1> From: "Jan Mikkelsen" To: "John Utz" Cc: References: Subject: Re: Getting gcj to run on FreeBSD Date: Tue, 9 Oct 2001 07:02:55 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org "John Utz" wrote: > well, given my profound unfamiliarity with gjc....here goes nothin ' :-) Thanks for the reply! > On Tue, 9 Oct 2001, Jan Mikkelsen wrote: > > > "Jan Mikkelsen" wrote: > > > It builds fine, but a hello program either core dumps (with dynamic > > linking) > > > or fails to link with unresolved externals to "java::util::List::class$". > > given that gjc is a java to native exe compiler, does it not follow that > you would need a natively compiled libgjc that contains native > implementations of the classes found in CLASSES.jar or does it expect to > resolve dependencies via the java jar files? I have a natively built gcj: $ ls -l /pkgs/gcc-3.0.1/lib/libgcj* -rw-r--r-- 1 root wheel 28589106 Aug 23 23:06 /pkgs/gcc-3.0.1/lib/libgcj.a -rwxr-xr-x 1 root wheel 789 Aug 23 23:06 /pkgs/gcc-3.0.1/lib/libgcj.la lrwxr-xr-x 1 root wheel 11 Aug 23 23:06 /pkgs/gcc-3.0.1/lib/libgcj.so -> libgcj.so.2 -rwxr-xr-x 1 root wheel 25549610 Aug 23 23:06 /pkgs/gcc-3.0.1/lib/libgcj.so.2 -rw-r--r-- 1 root wheel 478 Aug 23 23:06 /pkgs/gcc-3.0.1/lib/libgcj.spec -rw-r--r-- 1 root wheel 1524 Aug 23 23:06 /pkgs/gcc-3.0.1/lib/libgcjdata.a -rw-r--r-- 1 root wheel 375732 Aug 23 23:08 /pkgs/gcc-3.0.1/lib/libgcjgc.a -rwxr-xr-x 1 root wheel 741 Aug 23 23:08 /pkgs/gcc-3.0.1/lib/libgcjgc.la lrwxr-xr-x 1 root wheel 13 Aug 23 23:08 /pkgs/gcc-3.0.1/lib/libgcjgc.so -> libgcjgc.so.1 -rwxr-xr-x 1 root wheel 302291 Aug 23 23:08 /pkgs/gcc-3.0.1/lib/libgcjgc.so.1 I can see that it is being used because other symbols from libgcj are being resolved during the static linking process. This is the output from a static compile: $ /pkgs/gcc-3.0.1/bin/gcj -static --main=hello hello.java /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/../../../libgcj.a( Vector.o):/home/janm/Kits/gcc-3.0.1/libjava/java/util/Vector.java:232: undefined reference to `java::util::List::class$' /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/../../../libgcj.a( AbstractList.o): In function `java::util::AbstractList::equals(java::lang::Object*)': /home/janm/Kits/gcc-3.0.1/libjava/java/util/AbstractList.java:88: undefined reference to `java::util::List::class$' /home/janm/Kits/gcc-3.0.1/libjava/java/util/AbstractList.java:91: undefined reference to `java::util::List::class$' /home/janm/Kits/gcc-3.0.1/libjava/java/util/AbstractList.java:91: undefined reference to `java::util::List::class$' /home/janm/Kits/gcc-3.0.1/libjava/java/util/AbstractList.java:95: undefined reference to `java::util::List::class$' /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/../../../libgcj.a( AbstractList.o):/home/janm/Kits/gcc-3.0.1/libjava/java/util/AbstractList.jav a:95: more undefined references to `java::util::List::class$' follow collect2: ld returned 1 exit status hello.java contains: class hello { static void main(String[] args) { System.out.println("hello, world"); } } > > Sorry to follow up my own message. The unresolved externals happen with > > static linking. > > static linking to what? it would seem to me that if there is a libgjc.a > that it would have to be referenced in the link command line.... is it? Yes. From the gcj command line above, with the '-v' option added: /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/collect2 -m elf_i386 -V -Bstatic /usr/lib/crt1.o /usr/lib/crti.o /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/crtbegin.o -u data_start /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/../../../libgcjdat a.a -L/pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1 -L/pkgs/gcc- 3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/../../.. /var/tmp/ccKmRulPmain.o /var/tmp/ccVHynhZ.o -lgcc -lgcj -lm -lgcjgc -lzgcj -lgcc -lc -lgcc /pkgs/gcc-3.0.1/lib/gcc-lib/i386-unknown-freebsd4.3/3.0.1/crtend.o /usr/lib/crtn.o I am also seeing the same problem with the 20011001 snapshot on another machine. I suspect I've done something wrong during the gcc/gcj build process, but "configure" and "gmake bootstrap" isn't really that complex. Thanks, Jan Mikkelsen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message