<br><div class="gmail_quote">2010/2/12 Mark Evenson <span dir="ltr"><<a href="mailto:evenson@panix.com">evenson@panix.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 2/11/10 7:45 PM, Paul Griffioen wrote:<br>
[…]<br>
<div class="im"><br>
> I work with Netbeans 6.8 (just upgraded for ANT) and run the build from<br>
> the menu. Running the generated jar with 'java -jar abcl.jar geeft'<br>
> gives the following message:<br>
><br>
> Failed to load Main-Class manifest attribute from<br>
> abcl.jar<br>
><br>
> I noticed that the manifest.mf just contains the following:<br>
><br>
> Manifest-Version: 1.0<br>
> Ant-Version: Apache Ant 1.7.1<br>
> Created-By: 1.6.0_0-b11 (Sun Microsystems Inc.)<br>
> Class-Path:<br>
><br>
> Is the Netbeans build supposed to work? Does anybody have any idea why<br>
> the Main is not in the generated manifest?<br>
<br>
</div>You have found a bug for which I've applied a fix to make the Netbeans<br>
produced runnable JARs in [svn r12449][1].<br>
<br></blockquote><div><br>Thanks for the fix! Works perfectly now.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Although we use Netbeans for interactive debugging, we typically do<br>
final packaging of ABCL by running the Ant task 'abcl.jar', which is<br>
unfortunately a different code path than the way Netbeans generates the<br>
jar. Although Netbeans creates 'dist/abcl.jar' it never executes it<br>
itself, instead using the buildpath elements, so we hadn't really tested<br>
the Netbeans produced JAR.<br>
<br>
[1]: <a href="http://trac.common-lisp.net/armedbear/changeset/12449" target="_blank">http://trac.common-lisp.net/armedbear/changeset/12449</a><br>
<div class="im"><br>
> A second question is what the best way is to include the jna library.<br>
> I'm trying to compile CFFI with ABCL but that required jna as the<br>
> following quote from CFFI's code shows:<br>
><br>
> ;;; This implementation requires the Java Native Access (JNA) library.<br>
> ;;; <<a href="http://jna.dev.java.net/" target="_blank">http://jna.dev.java.net/</a>><br>
><br>
> I downloaded the required jna.jar and figured that I could include it<br>
> somehow in abcl.jar after building that. Unfortunately that build failed<br>
> but I would like to be able to use it from Netbeans anyway. Does anybody<br>
> know how to do that? My knowledge of the Java ecosystem is limited so<br>
> figuring this out for ABCL specifically is not easy.<br>
<br>
</div>Which version CFFI? I know that [Luís Olivera had created some<br>
patches][2] last Summer, but I didn't know if they had been merged back<br>
into the CFFI main distribution. Fleshing out his implementation (it<br>
was missing callbacks) is one of my many todo items. I'd be interested<br>
in hearing about your experiences (when you have some!)<br>
<br>
[2]: <a href="http://common-lisp.net/%7Eloliveira/patches/cffi-abcl.diff" target="_blank">http://common-lisp.net/~loliveira/patches/cffi-abcl.diff</a><br>
<br></blockquote><div><br>I checked out the latest version of CFFI and worked with the code in there. That compiles if I apply the following patch:<br><br>diff -rN old-cffi/src/cffi-abcl.lisp new-cffi/src/cffi-abcl.lisp<br>
350c350<br>< (defmacro %foreign-funcall (name args &key library calling-convention)<br>---<br>> (defmacro %foreign-funcall (name args &key library convention)<br>356c356<br>< (defmacro %foreign-funcall-pointer (ptr args &key calling-convention)<br>
---<br>> (defmacro %foreign-funcall-pointer (ptr args &key convention)<br>359c359<br>< `(%%foreign-funcall (make-function-pointer ,ptr ',calling-convention)<br>---<br>> `(%%foreign-funcall (make-function-pointer ,ptr ',convention)<br>
369c369<br>< &key calling-convention)<br>---<br>> &key convention)<br><br>The :calling-convention keyword seems to be replaced by :convention. <br><br>I don't use CFFI directly but it is used by cl-sqlite. This seams to work, although I have some problem with the FIXNUM size. Untill I figure out what in cl-sqlite causes that I cannot tell much more, but ABCL works just fine.<br>
<br>I tried to run the test-suite in TRIVIAL-FEATURES (it uses cffi for its tests) but that doesn't work. It looks like it is related to cffi-grovel but I didn't exactly understand what was going on there. I guess grovel needs something added for ABCL because it works in other Lisps.<br>
<br>I would be interested in getting CFFI working for ABCL because that would make my application run in ABCL. If I can help in any way please let me know.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Incorporating additional JAR files in the Netbeans build involves 1)<br>
Opening the project properties dialog by choosing "File >> Project<br>
Properties" from the main menu bar. 2) Under categories choosing<br>
"Libraries". 3) Choosing "Run" from the type of libraries. 4) Choose<br>
"Add JAR/Folder" 5) choose the local path location of 'jna.jar'.<br>
<br>
But the preferred way to add JAR files to the ABCL runtime classpath is<br>
to set the 'additional.jars' property and use the 'abcl.wrapper' task.<br>
To do this first copy the file '<a href="http://build.properties.in" target="_blank">build.properties.in</a>' to<br>
'build.properties'. Then add a line<br>
<br>
additional.jars=/Path/to/jna.jar<br>
<br>
specifying the local location of 'jna.jar'. Now, when the task<br>
'abcl.wrapper' is executed an 'abcl' ('abcl.bat' under Microsoft<br>
Windows) script is created which includes the contents of this property<br>
in the classpath. Note that this wrapper script can't be executed<br>
directly by Netbeans, which is was goal of your question.<br>
<br>
To execute 'abcl.wrapper' from Netbeans, open 'build.xml' in the<br>
Navigator view. Right click on the 'abcl.wrapper' target, the choose<br>
"Run Target" from the popup menu.<br>
<div class="im"><br></div></blockquote><div><br>Thanks again. Building from Netbeans works fine now<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">
><br>
> Finally I would appreciate feedback on the following patch for<br>
> TRIVIAL-FEATURES I needed to write to get CFFI to compile. It turned out<br>
> that the endianess feature wasn't set.<br>
><br>
> diff -rN old-trivial-features/src/tf-abcl.lisp<br>
> new-trivial-features/src/tf-abcl.lisp<br>
> 31c31,38<br>
> < ;;; TODO<br>
> ---<br>
> > (pushnew (let ((order (jcall "toString"<br>
> > (jstatic "nativeOrder"<br>
> "java.nio.ByteOrder"))))<br>
> > (cond ((string-equal order "LITTLE_ENDIAN")<br>
> > :little-endian)<br>
> > ((string-equal order "BIG_ENDIAN")<br>
> > :big-endian)<br>
> > (t (error "Byte order ~A unknown" order))))<br>
> > *features*)<br>
><br>
> Like I said, I'm no Java expert and feedback would be helpful.<br>
<br>
</div>Your Java code looks fine. I don't know the semantics of<br>
TRIVIAL-FEATURES, but note that ABCL itself is :BIG-ENDIAN as that is<br>
the standard for the JVM. Of course, CFFI needs to know the endian<br>
nature of the external interface, so your code is reasonable for CFFI's<br>
usage.<br>
<font color="#888888"><br>
--<br>
"A screaming comes across the sky. It has happened before, but there<br>
is nothing to compare to it now."<br>
<br>
_______________________________________________<br>
armedbear-devel mailing list<br>
<a href="mailto:armedbear-devel@common-lisp.net">armedbear-devel@common-lisp.net</a><br>
<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel" target="_blank">http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel</a><br>
</font></blockquote></div><br>