delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/18/05:47:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Date: Thu, 18 Feb 2010 11:43:10 +0100
From: Gary <cygwin AT garydjones DOT name>
To: cygwin AT cygwin DOT com
Subject: "undefined reference to `_JNI_CreateJavaVM'"
Message-ID: <20100218104310.GB3156@mimosa.garydjones.name>
Mail-Followup-To: cygwin AT cygwin DOT com
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I am trying to call some Java code from C via JNI, and am having
problems building:

main.o:main.c:(.text+0xcc): undefined reference to `_JNI_CreateJavaVM'

I've basically followed along with what is written at
http://www.inonit.com/cygwin/jni/invocationApi/ (built an import
library, passed ld the "-L. -ljvm" parameters, and so on). One difference
is that gcc no longer supports -mno-cygwin, but I'm not convinced that
is the cause.

Further information:
I am trying to use the straight Windows Java at first, by specifying
-I$jdk/include and everything appears to compile okay, *but* if I also
specify -I$jdk/include/win32 (as per the above mentioned web pages) then
compilation fails:

In file included from /mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:27,
                 from myhdr.h:4,
                 from main.c:1:
/mnt/c/Programme/Develop/Java/SDK/jdk/include/win32/jni_md.h:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'jlong'
In file included from myhdr.h:4,
                 from main.c:1:
/mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:108: error: expected specifier-qualifier-list before 'jlong'
/mnt/c/Programme/Develop/Java/SDK/jdk/include/jni.h:316: error: expected specifier-qualifier-list before 'jlong'

Given that I appear to have two sets of JNI related include files and so
forth installed (Sun and gcc), I'm wondering if that's the cause -
should I actually be using the gcc supplied files in preference to the
Sun ones?

Does anyone have any recent experience in this area they could share,
please?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019