hzzc1987 / jnaerator

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

Unable to parse GLib #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to janearate glib.h on Linux Ubuntu 9.04
2. Set up Maven project with the following config values:
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/linux
-I/usr/lib/gcc/i486-linux-gnu/4.3/include -library Gtk
/usr/include/glib-2.0/glib.h
3. Run the Maven JNAerator plugin

What is the expected output? What do you see instead?

Expected to get a JAR with GLib bindings. 
Instead get:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building gtk
[INFO]    task-segment: [com.jnaerator:maven-jnaerator-plugin:jnaerate]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jnaerator:jnaerate
[INFO] No goals needed for project - skipping
[INFO] [jnaerator:jnaerate {execution: default-cli}]
os.arch = i386
/usr/include/glib-2.0/glib/gmessages.h:128:12: error: error in macro
parameters: ...
/usr/include/glib-2.0/glib/gmessages.h:133:37: error: error in macro
parameters: ...
/usr/include/glib-2.0/glib/gmessages.h:136:15: error: error in macro
parameters: ...
/usr/include/glib-2.0/glib/gmessages.h:139:14: error: error in macro
parameters: ...
/usr/include/glib-2.0/glib/gmessages.h:142:12: error: error in macro
parameters: ...
JNAeration completed !
/media/My Passport/Jacek/Dev/Scala/gtk4j/target/generated-sources/java

What version of the product are you using? On what operating system?

0.9.1, Ubuntu 9.04
Please provide any additional information below.

Original issue reported on code.google.com by jace...@gmail.com on 29 Oct 2009 at 7:38

Attachments:

GoogleCodeExporter commented 8 years ago
Added Maven pom.xml

Original comment by jace...@gmail.com on 29 Oct 2009 at 7:39

Attachments:

GoogleCodeExporter commented 8 years ago
Hi jacek,

Thanks for your report :)
If there is really no source generated in /media/My 
Passport/Jacek/Dev/Scala/gtk4j/target/generated-sources/java, could you please 
try 
adding the "-v" verbosity switch to your JNAerator command ?

Thanks

Original comment by olivier.chafik@gmail.com on 29 Oct 2009 at 7:44

GoogleCodeExporter commented 8 years ago
yes, there is no source :-(

Here is the attached output with the verbosity switch on

Original comment by jace...@gmail.com on 29 Oct 2009 at 8:00

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, wrong version...

Original comment by jace...@gmail.com on 29 Oct 2009 at 8:02

GoogleCodeExporter commented 8 years ago
Attaching proper file

Original comment by jace...@gmail.com on 29 Oct 2009 at 8:04

GoogleCodeExporter commented 8 years ago

Original comment by jace...@gmail.com on 29 Oct 2009 at 8:04

Attachments:

GoogleCodeExporter commented 8 years ago
P.S. As you may have guessed, my aim is to try to generate bindings for the 
whole
GTK+ stack, i.e. glib, gobject, pango and last but not least the gtk+ UI 
toolkit.

Original comment by jace...@gmail.com on 30 Oct 2009 at 1:27

GoogleCodeExporter commented 8 years ago
Hehe, I did hope that someone would take on that heavy task !
You're gonna need to inspect the _jnaerator.preprocessed.c file : it contains 
the 
result of the preprocessing pass.
You can then copy-paste gradually larger portions of this file into JNAerator 
Studio 
and see what it outputs.
This way, you should be able to identify the code that breaks everything...
(and if you attach this file here, I'll be able to help too :-))
Cheers

Original comment by olivier.chafik@gmail.com on 30 Oct 2009 at 1:37

GoogleCodeExporter commented 8 years ago
Yeah, the problem is that my C knowledge is ZERO (can you say I am way out of my
league here?). I know the Java-GNOME project uses JNI and unfortunately they are
often behind on features (e.g. no support for GtkBuilder yet).

OK, I will try the pre-processor support and keep posting updates in this 
defect.

Original comment by jace...@gmail.com on 30 Oct 2009 at 2:01

GoogleCodeExporter commented 8 years ago
I almost forgot...
Had to deal with a few GLib issues when I wrapped the Mono library.
You should try taking some arguments from this .jnaerator file :
http://code.google.com/p/nativelibs4java/source/browse/trunk/libraries/Mono/Mono
.base.j
naerator

Original comment by olivier.chafik@gmail.com on 30 Oct 2009 at 2:18

GoogleCodeExporter commented 8 years ago
Put them in, not much of a difference. This seems to be the core issue right 
now:

Failed to convert define 'G_CSET_LATINS => "\337\340\341\342\343\344\345\346"
"\347\350\351\352\353\354\355\356\357\360" "\361\362\363\364\365\366"
"\370\371\372\373\374\375\376\377":
java.lang.StringIndexOutOfBoundsException: String index out of range: 32
Failed to convert define 'G_CSET_LATINC => "\300\301\302\303\304\305\306"
"\307\310\311\312\313\314\315\316\317\320" "\321\322\323\324\325\326"
"\330\331\332\333\334\335\336":
java.lang.StringIndexOutOfBoundsException: String index out of range: 28

is that in jnaerator or in the C parser you use?

Original comment by jace...@gmail.com on 30 Oct 2009 at 2:28

GoogleCodeExporter commented 8 years ago
Hi, any updates on this? Would you have any pointers on what I could do 
successfully 
generate the Glib bindings? thank you

Original comment by jace...@gmail.com on 20 Nov 2009 at 4:17

GoogleCodeExporter commented 8 years ago
Hi Jacek,
I'll be getting to GLib parsing probably at the beginning of next week, I've 
been very 
busy with Maven changes lately...
Stay tuned :)
Cheers

Original comment by olivier.chafik@gmail.com on 27 Nov 2009 at 1:36

GoogleCodeExporter commented 8 years ago
Thank you much appreciated.

Original comment by jace...@gmail.com on 27 Nov 2009 at 1:58

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

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:24