From owner-freebsd-java Sun Dec 26 6:24: 7 1999 Delivered-To: freebsd-java@freebsd.org Received: from yourbox.net (eraclito.yourbox.net [151.4.128.2]) by hub.freebsd.org (Postfix) with ESMTP id 97AF814D3D for ; Sun, 26 Dec 1999 06:24:02 -0800 (PST) (envelope-from gea@yourbox.net) Received: from yourbox.net (socrate.yourbox.net [151.4.128.4]) by yourbox.net (8.9.3/8.9.3) with ESMTP id PAA17898; Sun, 26 Dec 1999 15:23:50 +0100 (CET) (envelope-from gea@yourbox.net) Message-ID: <386624F5.82ED5331@yourbox.net> Date: Sun, 26 Dec 1999 15:23:49 +0100 From: Amedeo Beck Peccoz Organization: GEA Software S.r.l. X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 3.4-STABLE i386) X-Accept-Language: it, en, fr, de MIME-Version: 1.0 To: rgireyev@cnmnetwork.com, freebsd-java@FreeBSD.ORG Subject: Re: java compilers core dump on 3.x References: <199912260622.HAA15352@yourbox.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Rudy Gireyev wrote: > > You need an ELF version of the jdk for 3.x systems. > It looks like you are running the a.out version which > is why it works on 2.x I do have an ELF version installed on the 3.4 systems: ll /usr/ports/distfiles/jdk1.1.8_ELF.V1999-11-9.tar.gz -rw-r--r-- 1 root wheel 11522659 Nov 10 00:48 /usr/ports/distfiles/jdk1.1.8_ELF.V1999-11-9.tar.gz And an AOUT version on the 2.2.8 system: ll /usr/ports/distfiles/jdk1.1.8_AOUT.V99-9-22.tar.gz -rw-r--r-- 1 root wheel 13146232 Nov 2 16:10 /usr/ports/distfiles/jdk1.1.8_AOUT.V99-9-22.tar.gz Thank you for your help anyhow! :-) -- Amedeo Beck Peccoz To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message From owner-freebsd-java Thu Dec 30 13:44:32 1999 Delivered-To: freebsd-java@freebsd.org Received: from cric.chemres.hu (www.chemres.hu [193.224.146.131]) by hub.freebsd.org (Postfix) with ESMTP id A1E5A15071 for ; Thu, 30 Dec 1999 13:44:27 -0800 (PST) (envelope-from kuti@chemres.hu) Received: from ppp5.chemres.hu (ppp5.chemres.hu [193.224.67.183]) by cric.chemres.hu (8.9.2/8.9.2) with SMTP id WAA18862 for ; Thu, 30 Dec 1999 22:33:34 +0100 Message-Id: <199912302133.WAA18862@cric.chemres.hu> From: "Zsolt Kuti" To: "freebsd-java@FreeBSD.ORG" Date: Mon, 27 Dec 99 01:20:41 Reply-To: "Zsolt Kuti" X-Mailer: PMMail 1.53 For OS/2 UNREGISTERED SHAREWARE MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit Subject: auth 0558fc44 subscribe freebsd-java kuti@chemres.hu Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org auth 0558fc44 subscribe freebsd-java kuti@chemres.hu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message From owner-freebsd-java Fri Dec 31 16: 7:39 1999 Delivered-To: freebsd-java@freebsd.org Received: from ns1.1connect.com (216-59-79-65.usa2.flashcom.net [216.59.79.65]) by hub.freebsd.org (Postfix) with ESMTP id 1C7C714C9A; Fri, 31 Dec 1999 16:07:33 -0800 (PST) (envelope-from keith@1connect.com) Received: from 1connect.com ([10.0.0.75]) by ns1.1connect.com (8.9.3/8.9.1) with ESMTP id QAA71491; Fri, 31 Dec 1999 16:06:58 -0800 (PST) (envelope-from keith@1connect.com) Message-ID: <386D454B.694B5093@1connect.com> Date: Fri, 31 Dec 1999 16:07:40 -0800 From: Keith Wong X-Mailer: Mozilla 4.7 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-java@freebsd.org, freebsd-questions@freebsd.org Subject: java JNI compile problems Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi All, I want to use the java JNI to integrated with C. And, i tried to follow the example at the java.sun's website. then I get the problem when I try to compile the shared the library using gcc -g, then i get the error. i don't know is the -g parameter that i used it's right or not. the error i got are: /usr/lib/crt1.o: In function `_start': /usr/lib/crt1.o(.text+0x69): undefined reference to `main' I try the same step at Win98 with Visual C++ and it worked with no problems. May be I need the right parameter. Is the JNI work at Freebsd? Thanks for the help!! Here are the source. Keith HelloWorld.java ****************************************** class HelloWorld { public native void displayHelloWorld(); static { System.loadLibrary("hello"); } public static void main(String[] args) { new HelloWorld().displayHelloWorld(); } } ****************************************** %javac HelloWorld.java %javah -jni HelloWord HelloWorld.h ******************************************* /* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class HelloWorld */ #ifndef _Included_HelloWorld #define _Included_HelloWorld #ifdef __cplusplus extern "C" { #endif /* * Class: HelloWorld * Method: displayHelloWorld * Signature: ()V */ JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif ***************************************************** HelloWorldImp.c ******************************************************* #include #include "HelloWorld.h" #include JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj) { printf("Hello world!\n"); return; } ******************************************************** % gcc -g -I/usr/local/jdk1.1.8/include/ -I/usr/local/jdk1.1.8/include/freebsd HelloWorldImp.c -o libhello.so /usr/lib/crt1.o: In function `_start': /usr/lib/crt1.o(.text+0x69): undefined reference to `main' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message From owner-freebsd-java Fri Dec 31 18:27: 7 1999 Delivered-To: freebsd-java@freebsd.org Received: from fnal.fnal.gov (fnal.fnal.gov [131.225.9.8]) by hub.freebsd.org (Postfix) with ESMTP id 9E9F014E8A for ; Fri, 31 Dec 1999 18:27:05 -0800 (PST) (envelope-from tez@nova.fnal.gov) Received: from nova.fnal.gov ([131.225.18.207]) by FNAL.FNAL.GOV (PMDF V5.2-32 #36665) with ESMTP id <01JK5XG0PCXS0009AU@FNAL.FNAL.GOV> for freebsd-java@FreeBSD.ORG; Fri, 31 Dec 1999 20:27:02 -0600 CDT Received: from localhost (tez@localhost) by nova.fnal.gov (8.9.1b+Sun/8.9.1) with ESMTP id UAA12362; Fri, 31 Dec 1999 20:27:00 -0600 (CST) Date: Fri, 31 Dec 1999 20:27:00 -0600 (CST) From: Tim Zingelman Subject: Re: java JNI compile problems In-reply-to: <386D454B.694B5093@1connect.com> To: Keith Wong Cc: freebsd-java@FreeBSD.ORG Reply-To: Tim Zingelman Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Keywords: java JNI gcc compile build shared undefined main lib library To build a shared library you will want to use -fpic & -shared % gcc -fpic -shared -g -I/usr/local/jdk1.1.8/include/ -I/usr/local/jdk1.1.8/include/freebsd HelloWorldImp.c -o libhello.so The -g just adds debug info... -fpic makes it position independent and -shared makes it a shared library. Also if you are running an older (non-ELF) machine, you will need to add the -aout flag to build compatible libraries. - Tim On Fri, 31 Dec 1999, Keith Wong wrote: > Hi All, > I want to use the java JNI to integrated with C. And, i tried to follow > the example at the java.sun's website. then I get the problem when I > try to compile the shared the library using gcc -g, then i get the > error. > Keith > > % gcc -g -I/usr/local/jdk1.1.8/include/ > -I/usr/local/jdk1.1.8/include/freebsd HelloWorldImp.c > -o libhello.so > /usr/lib/crt1.o: In function `_start': > /usr/lib/crt1.o(.text+0x69): undefined reference to `main' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message