Re: Classpath on Cgwin: UnsatisfiedLinkError problem
On Wed, 2006-02-08 at 21:11 -0600, Archie Cobbs wrote: S. Meslin-Weber wrote: VM writers typically handle the delegated loadLibrary() call via their implementation of the VM* interface classes and in their own native code. As cygwin uses a decidedly odd naming convention for its dlls, I'd say those parts of jc would need to be investigated. IIRC, Cygwin calles its equivalent of libjavanio.so cygjavanio-0.dll. So... what's an #ifdef one can use on cygwin to detect cygwin? E.g. #ifdef WINDOWS or #ifdef CYGWIN or something? (This is hard for me to fix right now because I don't have cygwin set up anywhere). Presumably other VMs have the same issue (if they want to run on cygwin). Has anyone already solved this problem? Yes. See 2005-09-13 Dalibor Topic [EMAIL PROTECTED] * libraries/java/java/lang/Runtime.java (loadLibrary) Try multiple different prefixes and suffixes if library can't be loaded using the mapped name. This takes care of Cygwin DLLs, Libtool modules and hopefully will work for dylibs, jnilibs and similar DSO variants as well. ( http://www.kaffe.org/pipermail/kaffe/2005-September/103250.html ) in Kaffe. If it works for you, we should fold it into VMRuntime, I guess. cheers, dalibor topic
Re: Classpath on Cgwin: UnsatisfiedLinkError problem
Archie Cobbs wrote: S. Meslin-Weber wrote: VM writers typically handle the delegated loadLibrary() call via their implementation of the VM* interface classes and in their own native code. As cygwin uses a decidedly odd naming convention for its dlls, I'd say those parts of jc would need to be investigated. IIRC, Cygwin calles its equivalent of libjavanio.so cygjavanio-0.dll. So... what's an #ifdef one can use on cygwin to detect cygwin? E.g. #ifdef WINDOWS or #ifdef CYGWIN or something? (This is hard for me to fix right now because I don't have cygwin set up anywhere). Presumably other VMs have the same issue (if they want to run on cygwin). Has anyone already solved this problem? Enrico: the relevant macro is _JC_LIBRARY_FMT in definitions.h. Perhaps you can play with some possibilities there. Thanks, -Archie Hi Archie and Steph, I found _JC_LIBRARY_FMT in arch_definitions.h and replaced .so with .dll.a, which is the file extension of the dll libary created by Classpath. Now I got an annoying problem on my WindowsXP Home Edition: jc can't execute the libjavanio.dll.a library because permission is denied. I tried to change the file access permission, from: -rwxr--r-- /usr/local/classpath/lib/classpath/libjavanio.dll.a to -rwxr-xr-x /usr/local/classpath/lib/classpath/libjavanio.dll.a but Cygwin doesn't let me do it because, I think, the user Enrico is not the Administrator. Then I tried to add a new user named Administrator but Windows XP Home Edition doesn't let me do it because Administrator exists already I think I have to retry on a Windows Professional Edition. I'll do this job during the weekend. ciao, Enrico
Classpath on Cgwin: UnsatisfiedLinkError problem
Hi guys, after building Classpath on Cygwin, I'm now trying to use it in a simple HelloWorld application. As an interpreter, I'm using JC (by Archie Cobbs). When I run: $jc HelloWorld I got the following exception: java.lang.UnsatisfiedLinkError: failed to open native library: 'usr/local/classpath/lib/classpath/libjavanio.so' The reason, I think, is that Classpath doesn't know it's running on Cygwin, therefore it looks for libjavanio.so instead of libjavanio.dll (which exists on the filesytem). Can anyone help out? thanks for any help, Enrico
Re: Classpath on Cgwin: UnsatisfiedLinkError problem
Hi Enrico, On Wed, Feb 08, 2006 at 02:14:59PM +0100, Enrico Migliore wrote: after building Classpath on Cygwin, I'm now trying to use it in a simple HelloWorld application. As an interpreter, I'm using JC (by Archie Cobbs). When I run: $jc HelloWorld I got the following exception: java.lang.UnsatisfiedLinkError: failed to open native library: 'usr/local/classpath/lib/classpath/libjavanio.so' The reason, I think, is that Classpath doesn't know it's running on Cygwin, therefore it looks for libjavanio.so instead of libjavanio.dll (which exists on the filesytem). When initially writing the CygwinOnClasspath[0] wiki entry on the mediation wiki, I came across the same issue. I found that the problem is actually not in GNU Classpath but more in how specific VMs deal with loadLibrary calls. For example, java.nio.channels.FileChannelImpl in GNU Classpath uses the following for loading its native library: if (Configuration.INIT_LOAD_LIBRARY) { System.loadLibrary(javanio); } VM writers typically handle the delegated loadLibrary() call via their implementation of the VM* interface classes and in their own native code. As cygwin uses a decidedly odd naming convention for its dlls, I'd say those parts of jc would need to be investigated. IIRC, Cygwin calles its equivalent of libjavanio.so cygjavanio-0.dll. Hope this helps, Steph [0] http://developer.classpath.org/mediation/ClasspathOnCygwin -- Stephane Meslin-Weber Email: [EMAIL PROTECTED] Senior Software Engineer Web: http://odonata.tangency.co.uk signature.asc Description: Digital signature
Re: Classpath on Cgwin: UnsatisfiedLinkError problem
On Wed, Feb 08, 2006 at 03:19:19PM +, S. Meslin-Weber wrote: When initially writing the CygwinOnClasspath[0] wiki entry on the ... [0] http://developer.classpath.org/mediation/ClasspathOnCygwin Woops... I did mean ClasspathOnCygwin (the link is correct) CygwinOnClasspath would be an interesting project! -- Stephane Meslin-Weber Email: [EMAIL PROTECTED] Senior Software Engineer Web: http://odonata.tangency.co.uk signature.asc Description: Digital signature
Re: Classpath on Cgwin: UnsatisfiedLinkError problem
S. Meslin-Weber wrote: VM writers typically handle the delegated loadLibrary() call via their implementation of the VM* interface classes and in their own native code. As cygwin uses a decidedly odd naming convention for its dlls, I'd say those parts of jc would need to be investigated. IIRC, Cygwin calles its equivalent of libjavanio.so cygjavanio-0.dll. So... what's an #ifdef one can use on cygwin to detect cygwin? E.g. #ifdef WINDOWS or #ifdef CYGWIN or something? (This is hard for me to fix right now because I don't have cygwin set up anywhere). Presumably other VMs have the same issue (if they want to run on cygwin). Has anyone already solved this problem? Enrico: the relevant macro is _JC_LIBRARY_FMT in definitions.h. Perhaps you can play with some possibilities there. Thanks, -Archie __ Archie Cobbs *CTO, Awarix* http://www.awarix.com