Open ochafik opened 9 years ago
Hi @timk ,
Thanks for your detailed report!
I'll look into this issue asap, in the meanwhile could you please try with the -parseChunks option and attach the files generated with -v (rawParsed.cpp, errors.txt or other files that keep changing names with each version :-S https://code.google.com/p/jnaerator/wiki/TroubleShootingJNAeration )
Cheers
From @timk on July 2, 2012 13:24
With '-parseChunks', the parsing failed and produced a lot more output information! It seames like the methods, classes and more files is found.
However the parsing failes and this time produces no '.java'-files at all (without '-parseChunks' the library files was created).
I added all the output on gist since it was a lot of data, included the output and called it 'jnaerator output', there it seams to have why it crashed. https://gist.github.com/3033185
Some parts of the output:
...
Now parsing 2261 slices
Parsing failed : java.util.concurrent.TimeoutException
Parsing failed : java.util.concurrent.ExecutionException: com.ochafik.lang.jnaerator.JNAeratorParser$ParseError: Failed to parse because of java.lang.NullPointerException
Parsing failed : java.util.concurrent.ExecutionException: com.ochafik.lang.jnaerator.JNAeratorParser$ParseError: Failed to parse because of java.lang.NullPointerException
Parsing failed : java.util.concurrent.ExecutionException: com.ochafik.lang.jnaerator.JNAeratorParser$ParseError: Failed to parse because of java.lang.NullPointerException
Normalizing parsed code...
...
Guessing the below stats is Java problems after the parsing..?
...
931 problems (72 errors, 859 warnings)
...
And the crash:
...
com.ochafik.lang.compiler.CompilerUtils$CompilationError: Error in ? at line 2687, col 42 :
Type mismatch: cannot convert from double to float
Error in ? at line 2688, col 43 :
Type mismatch: cannot convert from double to float
...
at com.ochafik.lang.jnaerator.JNAerator$1$2.setFinished(JNAerator.java:692)
at com.ochafik.lang.jnaerator.JNAerator.jnaerate(JNAerator.java:973)
at com.ochafik.lang.jnaerator.JNAerator$1.finished(JNAerator.java:727)
at com.ochafik.lang.jnaerator.JNAeratorCommandLineArgs$ArgsParser.parse(JNAeratorCommandLineArgs.java:135)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:238)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:211)
#
# ERROR: JNAeration failed !
...
From @sequoiar on August 24, 2014 4:25
same issue with jnaerator-0.11-shaded.jar, that could not generate java code for C function.
From @Jeansen on October 14, 2014 11:27
I've got the same problem. Trying to run jnaerator against pdh.h results in a lot of files with version 0.9.9 but with 0.11 I get only the main wrapper and without any methods. Running with -parseChunks gives me:
Okt 14, 2014 11:18:12 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] ProgramFiles(x86)=C:\Program Files (x86)
Okt 14, 2014 11:18:12 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] VISUAL_STUDIO_HOME=C:\Program Files (x86)\Microsoft Visual Studio 9.0
Okt 14, 2014 11:18:12 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] ProgramFiles(x86)=C:\Program Files (x86)
Okt 14, 2014 11:18:12 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] WINDOWS_SDK_HOME=C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A
Okt 14, 2014 11:18:12 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] VISUAL_STUDIO_INCLUDES=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include
Auto-configuring parser...
Okt 14, 2014 11:18:12 AM com.ochafik.lang.jnaerator.JNAeratorConfigUtils getProp
INFO: [environment] JNAERATOR_INCLUDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include;.
Okt 14, 2014 11:18:12 AM com.ochafik.lang.jnaerator.JNAeratorConfigUtils getProp
INFO: [environment] JNAERATOR_FRAMEWORKS_PATH=/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks;/System/Library/Frameworks/ApplicationServices.framework
/Versions/Current/Frameworks;/System/Library/Frameworks;/Library/Frameworks;/Local/Library/Frameworks/;C:\Users\mlautenbach/Library/Frameworks
os.arch = amd64
Okt 14, 2014 11:18:12 AM com.ochafik.lang.jnaerator.JNAerator jnaerate
INFO: Include path :
C:\Program Files (x86)\Windows Kits\8.1\Include\um
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include
.
Parsing native headers...
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h:18:20: error: #error "No Target Architecture"
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h:18:2070: error: #error Must define a target architecture.
Writing preprocessor output to '_jnaerator.preprocessed.c'
Writing preprocessor macros to '_jnaerator.macros.cpp'
Now trying to parse sources slice by slice.
Now parsing 345 slices
Normalizing parsed code...
Writing raw parsed sources to '_jnaerator.rawParsed.cpp'
Writing normalized parsed sources to '_jnaerator.normalizedParsed.cpp'
Generating libraries...
Generating PROCESSOR_NUMBER.java
Generating GROUP_AFFINITY.java
Generating FLOAT128.java
Generating LARGE_INTEGER.java
Generating ULARGE_INTEGER.java
Generating LUID.java
Generating LIST_ENTRY.java
Generating SINGLE_LIST_ENTRY.java
Generating LIST_ENTRY32.java
Generating LIST_ENTRY64.java
Generating OBJECTID.java
Struct with no field : _ENUM_FLAG_INTEGER_FOR_SIZE<1 >
Generating _ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java
java.io.FileNotFoundException: .\test\_ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java (The filename, directory name, or volume label syntax is incorrect)
at com.ochafik.lang.jnaerator.JNAerator$1$2.setFinished(JNAerator.java:699)
at com.ochafik.lang.jnaerator.JNAerator.jnaerate(JNAerator.java:980)
at com.ochafik.lang.jnaerator.JNAerator$1.finished(JNAerator.java:734)
at com.ochafik.lang.jnaerator.JNAeratorCommandLineArgs$ArgsParser.parse(JNAeratorCommandLineArgs.java:135)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:239)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:212)
#
# ERROR: JNAeration failed !
#
# java.io.FileNotFoundException: .\test\_ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java (The filename, directory name, or volume label syntax is incorrect)
#
Version 0.12 SNAPSHOT gives me:
Okt 14, 2014 11:27:03 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] ProgramFiles(x86)=C:\Program Files (x86)
Okt 14, 2014 11:27:03 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] VISUAL_STUDIO_HOME=C:\Program Files (x86)\Microsoft Visual Studio 9.0
Okt 14, 2014 11:27:03 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] ProgramFiles(x86)=C:\Program Files (x86)
Okt 14, 2014 11:27:03 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] WINDOWS_SDK_HOME=C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A
Okt 14, 2014 11:27:03 AM com.ochafik.admin.visualstudio.VisualStudioUtils getProp
INFO: [environment] VISUAL_STUDIO_INCLUDES=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include
Auto-configuring parser...
Okt 14, 2014 11:27:04 AM com.ochafik.lang.jnaerator.JNAeratorConfigUtils getProp
INFO: [environment] JNAERATOR_INCLUDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include;.
Okt 14, 2014 11:27:04 AM com.ochafik.lang.jnaerator.JNAeratorConfigUtils getProp
INFO: [environment] JNAERATOR_FRAMEWORKS_PATH=/System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks;/System/Library/Frameworks/ApplicationServices.framework
/Versions/Current/Frameworks;/System/Library/Frameworks;/Library/Frameworks;/Local/Library/Frameworks/;C:\Users\mlautenbach/Library/Frameworks
os.arch = amd64
Okt 14, 2014 11:27:04 AM com.ochafik.lang.jnaerator.JNAerator jnaerate
INFO: Include path :
C:\Program Files (x86)\Windows Kits\8.1\Include\um
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include
.
Parsing native headers...
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h:18:20: error: #error "No Target Architecture"
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h:18:2070: error: #error Must define a target architecture.
Writing preprocessor output to '_jnaerator.preprocessed.c'
Writing preprocessor macros to '_jnaerator.macros.cpp'
Now parsing 345 slices
Normalizing parsed code...
Writing raw parsed sources to '_jnaerator.rawParsed.cpp'
Writing normalized parsed sources to '_jnaerator.normalizedParsed.cpp'
Generating libraries...
Generating PROCESSOR_NUMBER.java
Generating GROUP_AFFINITY.java
Generating FLOAT128.java
Generating LARGE_INTEGER.java
Generating ULARGE_INTEGER.java
Generating LUID.java
Generating LIST_ENTRY.java
Generating SINGLE_LIST_ENTRY.java
Generating LIST_ENTRY32.java
Generating LIST_ENTRY64.java
Generating OBJECTID.java
Struct with no field : _ENUM_FLAG_INTEGER_FOR_SIZE<1 >
Generating _ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java
java.io.FileNotFoundException: .\test\_ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.PrintWriter.<init>(Unknown Source)
at com.ochafik.lang.jnaerator.JNAerator$2.<init>(JNAerator.java:872)
at com.ochafik.lang.jnaerator.JNAerator.newFileWriter(JNAerator.java:872)
at com.ochafik.lang.jnaerator.JNAerator.newFileWriter(JNAerator.java:856)
at com.ochafik.lang.jnaerator.JNAerator$5.getSourceWriter(JNAerator.java:946)
at com.ochafik.lang.jnaerator.JNAerator.getSourceWriter(JNAerator.java:839)
at com.ochafik.lang.jnaerator.JNAerator$6.getSourceWriter(JNAerator.java:954)
at com.ochafik.lang.jnaerator.ClassOutputter.getClassSourceWriter(ClassOutputter.java:29)
at com.ochafik.lang.jnaerator.DeclarationsConverter.outputConvertedStruct(DeclarationsConverter.java:651)
at com.ochafik.lang.jnaerator.DeclarationsConverter.convertStructs(DeclarationsConverter.java:688)
at com.ochafik.lang.jnaerator.DeclarationsConverter.fillLibraryMapping(DeclarationsConverter.java:909)
at com.ochafik.lang.jnaerator.JNADeclarationsConverter.generateLibraryFiles(JNADeclarationsConverter.java:1147)
at com.ochafik.lang.jnaerator.JNAerator.generateLibraryFiles(JNAerator.java:1483)
at com.ochafik.lang.jnaerator.JNAerator.jnaerationCore(JNAerator.java:1455)
at com.ochafik.lang.jnaerator.JNAerator.jnaerate(JNAerator.java:1008)
at com.ochafik.lang.jnaerator.JNAerator$1.finished(JNAerator.java:776)
at com.ochafik.lang.jnaerator.JNAeratorCommandLineArgs$ArgsParser.parse(JNAeratorCommandLineArgs.java:152)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:224)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:197)
java.io.FileNotFoundException: .\test\_ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java (The filename, directory name, or volume label syntax is incorrect)
at com.ochafik.lang.jnaerator.JNAerator$1$2.setFinished(JNAerator.java:743)
at com.ochafik.lang.jnaerator.JNAerator.jnaerate(JNAerator.java:1056)
at com.ochafik.lang.jnaerator.JNAerator$1.finished(JNAerator.java:776)
at com.ochafik.lang.jnaerator.JNAeratorCommandLineArgs$ArgsParser.parse(JNAeratorCommandLineArgs.java:152)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:224)
at com.ochafik.lang.jnaerator.JNAerator.main(JNAerator.java:197)
#
# ERROR: JNAeration failed !
#
# java.io.FileNotFoundException: .\test\_ENUM_FLAG_INTEGER_FOR_SIZE<1 >.java (The filename, directory name, or volume label syntax is incorrect)
#
Different to version 0.11 with 0.12-SNAPSHOT there are some classes which got generated (but not all) and the wrapper is missing.
I just ran into a similar problem: JNAerator produced a bunch of static fields corresponding to #define
s, but not a single method. When I ran with the -v
option I noticed the following: the _jnaerator.preprocessed.c
file contained a number of unexpanded macros that did not have any corresponding definition in the _jnaerator.macros.cpp
file. Though I did not see any parsing errors reported further downstream, the preprocessed code (as far as I looked at it) clearly was not valid C/C++ code due to the unexpanded macro names being inserted in all sorts of places in the source code.
To fix my problem, I added -D
macro name=
options to config.jnaerator
, which removed the unexpanded macros and resulted in proper Java code generation. The spurious macros actually were defined (though I had to hunt across many #ifdef
s and #include
s), but somehow JNAerator's preprocessing did not pick up the correct values somewhere along the way...
From @timk on July 2, 2012 12:2
Hi.
I am trying to jnearate libav-0.8.3 but compared to the library FFMpeg built here there is a lot of classes and methods missing. And using that library or build script it fails from missing classes.
When building with 'jnaerator-0.10-shaded.jar' or 'jnaerator-0.11-SNAPSHOT-shaded.jar' the only files created is the library files as 'AVCodecLibrary.java'.
See this for reference for what should be: https://github.com/ochafik/nativelibs4java/tree/master/libraries/FFMpeg/src/main/java/com/nativelibs4java/ffmpeg/avcodec
I also found the issue https://github.com/ochafik/nativelibs4java/issues/288 where some of this is discussed but it isn't really a bug for this particular problem so I thought I'd open this to help pin the problem down.
My output
config.jnaerator
Example from AVCodecLibrary.java: http://pastebin.com/CZu3jgD5
Copied from original issue: ochafik/nativelibs4java#324