hzzc1987 / jnaerator

Automatically exported from code.google.com/p/jnaerator
0 stars 0 forks source link

problems with jnaerator parsing the fuse library on linux #54

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here's what I've tried:

java -jar jnaerator-0.9.3.jar -library fuse -o . -package my.jnafuse 
-D__s32=int -DFUSE_USE_VERSION=26 -D_FILE_OFFSET_BITS=64 -direct -jar
./jnafuse.jar -preferJavac -scanSymbols /usr/include/fuse.h /usr/lib/libfuse.so

Here's what I get: 
javacTask: no source files
Usage: javacTask <options> <source files>
use -help for a list of possible options
JNAeration completed !

jnaerator does create the jar file but doesn't generate any java classes in
it. 

Without the -preferJavac I get a complaint from the eclipse compiler. 

OS is ubuntu 9.04 fuse is version 26
java -version
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Server VM (build 10.0-b19, mixed mode)

Original issue reported on code.google.com by dige...@gmail.com on 3 Feb 2010 at 2:08

GoogleCodeExporter commented 8 years ago
Hi digerat,

Thanks for your report :)
Could you try again with the verbose (-v) switch and attach the resulting files 
? (in 
particular, the preprocessed sources)

Cheers

Original comment by olivier.chafik@gmail.com on 3 Feb 2010 at 3:12

GoogleCodeExporter commented 8 years ago
Thanks Oliver. I made some progress... at least I think I have ;^) 

I used the attached definition of commands to jnaerator and the result is I get 
no
warnings, and I get a jnafuse.jar created that has lots (all?) of what I need 
in it.
But I'm having a hard time loading the library as there is no INSTANCE defined 
in the
FuseLibrary.java that is generated. Following the Mono example (which shows how 
you
load the generated java library etc. it sure seems I need the INSTANCE there. 

If I try to follow the pattern used in the MonoLibrary of how instance is 
created in
my "calling program", I get the following error. 
--------------------------------------------------
Exception in thread "main" java.lang.ExceptionInInitializerError
    at my.program.UseJnaFuse.loadFuseLibrary(UseJnaFuse.java:38)
    at my.program.UseJnaFuse.main(UseJnaFuse.java:47)
Caused by: java.lang.IllegalArgumentException: Can't determine class with native
methods from the current context (class org.jnafuse.FuseLibrary)
    at com.sun.jna.Native.getNativeClass(Native.java:1042)
    at com.sun.jna.Native.register(Native.java:1013)
    at org.jnafuse.FuseLibrary.<clinit>(i>
    public static final int UNIX98_PTY_SLAVE_MAJOR =
(FuseLibrary.UNIX98_PTY_MASTER_MAJOR + FuseLibrary.UNIX98_PTY_MAJOR_COUNT);
}
:17)
    ... 2 more
Hello, World
--------------------------------------

Sorry to go on and on in an 'issue report', but I guess this is the place to 
discuss
using jnaerator, which if I can get it to work for this ROCKS! Thanks for all 
the
hard work creating it, it could be a great help in what I'm working on. 

Original comment by dige...@gmail.com on 4 Feb 2010 at 12:59

Attachments:

GoogleCodeExporter commented 8 years ago
One more file... the one that uses the jna fuse library and shows how I tried to
"simulate" what is normally done in the generated code that creates the 
library's
INSTANCE member. 

Original comment by dige...@gmail.com on 4 Feb 2010 at 12:22

Attachments:

GoogleCodeExporter commented 8 years ago
Here is a fuse.jnaerator file that "works". There are problems with the 
generated
code though, e.g. fuse_operations thinks it's using stat64 even though I 
believe it
should just be using stat as a type for arguments (see getattr_callback in
fuse_operations.java) However, you can load and use the generated java library
(getting it to work properly is another issue ;^) )

Original comment by dige...@gmail.com on 9 Feb 2010 at 12:41

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
This issue moved to Github :
https://github.com/ochafik/nativelibs4java/issues/138

Thanks for not updating this page anymore and adding further comments on Github.
Cheers
--
zOlive

Original comment by olivier.chafik@gmail.com on 1 Sep 2011 at 7:25