[armedbear-devel] Building with Netbeans

Paul Griffioen P.R.Griffioen at uva.nl
Fri Feb 12 19:58:33 UTC 2010

2010/2/12 Mark Evenson <evenson at panix.com>

> On 2/11/10 7:45 PM, Paul Griffioen wrote:
> […]
> > I work with Netbeans 6.8 (just upgraded for ANT) and run the build from
> > the menu. Running the generated jar with 'java -jar abcl.jar geeft'
> > gives the following message:
> >
> > Failed to load Main-Class manifest attribute from
> > abcl.jar
> >
> > I noticed that the manifest.mf just contains the following:
> >
> > Manifest-Version: 1.0
> > Ant-Version: Apache Ant 1.7.1
> > Created-By: 1.6.0_0-b11 (Sun Microsystems Inc.)
> > Class-Path:
> >
> > Is the Netbeans build supposed to work? Does anybody have any idea why
> > the Main is not in the generated manifest?
> You have found a bug for which I've applied a fix to make the Netbeans
> produced runnable JARs in [svn r12449][1].
Thanks for the fix! Works perfectly now.

> Although we use Netbeans for interactive debugging, we typically do
> final packaging of ABCL by running the Ant task 'abcl.jar', which is
> unfortunately a different code path than the way Netbeans generates the
> jar.  Although Netbeans creates 'dist/abcl.jar' it never executes it
> itself, instead using the buildpath elements, so we hadn't really tested
> the Netbeans produced JAR.
> [1]: http://trac.common-lisp.net/armedbear/changeset/12449
> > A second question is what the best way is to include the jna library.
> > I'm trying to compile CFFI with ABCL but that required jna as the
> > following quote from CFFI's code shows:
> >
> > ;;; This implementation requires the Java Native Access (JNA) library.
> > ;;; <http://jna.dev.java.net/>
> >
> > I downloaded the required jna.jar and figured that I could include it
> > somehow in abcl.jar after building that. Unfortunately that build failed
> > but I would like to be able to use it from Netbeans anyway. Does anybody
> > know how to do that? My knowledge of the Java ecosystem is limited so
> > figuring this out for ABCL specifically is not easy.
> Which version CFFI?  I know that [Luís Olivera had created some
> patches][2] last Summer, but I didn't know if they had been merged back
> into the CFFI main distribution.  Fleshing out his implementation (it
> was missing callbacks) is one of my many todo items. I'd be interested
> in hearing about your experiences (when you have some!)
> [2]: http://common-lisp.net/~loliveira/patches/cffi-abcl.diff<http://common-lisp.net/%7Eloliveira/patches/cffi-abcl.diff>
I checked out the latest version of CFFI and worked with the code in there.
That compiles if I apply the following patch:

diff -rN old-cffi/src/cffi-abcl.lisp new-cffi/src/cffi-abcl.lisp
< (defmacro %foreign-funcall (name args &key library calling-convention)
> (defmacro %foreign-funcall (name args &key library convention)
< (defmacro %foreign-funcall-pointer (ptr args &key calling-convention)
> (defmacro %foreign-funcall-pointer (ptr args &key convention)
<     `(%%foreign-funcall (make-function-pointer ,ptr ',calling-convention)
>     `(%%foreign-funcall (make-function-pointer ,ptr ',convention)
<                         &key calling-convention)
>                         &key convention)

The :calling-convention keyword seems to be replaced by :convention.

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.

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.

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

> Incorporating additional JAR files in the Netbeans build involves 1)
> Opening  the project properties dialog by choosing "File >> Project
> Properties" from the main menu bar.  2) Under categories choosing
> "Libraries".  3) Choosing "Run"  from the type of libraries.  4) Choose
> "Add JAR/Folder" 5) choose the local path location of 'jna.jar'.
> But the preferred way to add JAR files to the ABCL runtime classpath is
> to set the 'additional.jars' property and use the 'abcl.wrapper' task.
> To do this first copy the file 'build.properties.in' to
> 'build.properties'.  Then add a line
>        additional.jars=/Path/to/jna.jar
> specifying the local location of 'jna.jar'.  Now, when the task
> 'abcl.wrapper' is executed an 'abcl' ('abcl.bat' under Microsoft
> Windows) script is created which includes the contents of this property
> in the classpath.  Note that this wrapper script can't be executed
> directly by Netbeans, which is was goal of your question.
> To execute 'abcl.wrapper' from Netbeans, open 'build.xml' in the
> Navigator view.  Right click on the 'abcl.wrapper' target,  the choose
> "Run Target" from the popup menu.
Thanks again. Building from Netbeans works fine now

> >
> > Finally I would appreciate feedback on the following patch for
> > TRIVIAL-FEATURES I needed to write to get CFFI to compile. It turned out
> > that the endianess feature wasn't set.
> >
> > diff -rN old-trivial-features/src/tf-abcl.lisp
> > new-trivial-features/src/tf-abcl.lisp
> > 31c31,38
> > < ;;; TODO
> > ---
> >  > (pushnew (let ((order (jcall "toString"
> >  >                              (jstatic "nativeOrder"
> > "java.nio.ByteOrder"))))
> >  >            (cond ((string-equal order "LITTLE_ENDIAN")
> >  >                   :little-endian)
> >  >                  ((string-equal order "BIG_ENDIAN")
> >  >                   :big-endian)
> >  >                  (t (error "Byte order ~A unknown" order))))
> >  >          *features*)
> >
> > Like I said, I'm no Java expert and feedback would be helpful.
> Your Java code looks fine.  I don't know the semantics of
> TRIVIAL-FEATURES, but note that ABCL itself is :BIG-ENDIAN as that is
> the standard for the JVM.  Of course, CFFI needs to know the endian
> nature of the external interface, so your code is reasonable for CFFI's
> usage.
> --
> "A screaming comes across the sky.  It has happened before, but there
> is nothing to compare to it now."
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20100212/87686c89/attachment.html>

More information about the armedbear-devel mailing list