[PPL-devel] Windows, Java interface

Roberto Bagnara bagnara at cs.unipr.it
Wed Dec 30 19:34:47 CET 2009


On 11/30/09 12:57, Krzysztof Jakubczyk wrote:
> I've managed to compile PPL to a windows dll along with java interface
> using MinGW. I will describe how I achieved this step by step. First
> thing was to build the ppl library (not java interface) to a dll. I
> found out that to do this AC_LIBTOOL_WIN32_DLL must be added to autoconf
> along with '-no-undefined' to LDFLAGS (see
> http://sourceware.org/autobook/autobook/autobook_254.html ). I also
> based this on gmp's autoconf file. Patch is available in attached
> patch.configure.ac file (running autoconf is needed to create configure
> file). To compile ppl to a dll you need to run configure with
> parameters: "--disable-static --enable-shared".
>
> I didn't manage to compile ppl dll to use static gmp library version. I
> compiled gmp as a shared library (configure --enable-cxx
> --disable-static --enable-shared). Unfortunately make check fails when
> gmp is compiled like this - but it seems the library works ok. After
> compiling gmp I made copy of libgmp.dll.a as libgmp.a and libgmpxx.dll.a
> to libgmpxx.a so that PPL can be linked to it (possibly there is another
> solution).

Dear Krzysztof,

thank you very much for your message, and sorry for the long delay.
I have tried to follow the spirit of your advice (not the letter since,
e.g., AC_LIBTOOL_WIN32_DLL is a deprecated macro).  In particular,
I have added back the win32-dll Libtool option, even though I wonder
how it could work for you, since the Libtool manual says:

`win32-dll'
     This option should be used if the package has been ported to build
     clean dlls on win32 platforms. Usually this means that any library
     data items are exported with __declspec(dllexport) and imported
     with __declspec(dllimport). If this macro is not used, libtool
     will assume that the package libraries are not dll clean and will
     build only static libraries on win32 hosts.

And I am sure we did not decorate the library items with __declspec's.
Perhaps something in the toolchain is doing the right thing automatically?

> Later I had to compile the Java library (add --enable-interfaces=java,
> to configure arguments). I had some problems with configuring java path
> (--with-java=DIR) this is because I use the 64 bit windows system - java
> is installed in "C:\Program Files (x86)\Java\jdk1.6.0_17". (i passed
> --with-java="/c/Program Files (x86)/Java/jdk1.6.0_17") I had to manually
> update makefiles for java interface because javah was not properly
> found, includes were not properly generated (there was "-I/c/Program
> Files (x86)/Java/jdk1.6.0_17/include/mingw" instead of "-I/c/Program
> Files (x86)/Java/jdk1.6.0_17/include/win32") and had manually fix java
> directory issues (add "'s).

Hmm, can you help me to understand whether this is something we
can fix?

> Another important thing was to modify Makefile for the jni dll file
> (interfaces/Java/jni) (see http://www.mingw.org/node/41 ) - add "
> -D_JNI_IMPLEMENTATION_ -Wl,--kill-at" flags to libppl_java_la_LDFLAGS.
> After these modifications the dll was successfully build.

I think I have correctly implemented this.  I have just uploaded
a snapshot of PPL 0.11 (to be released soon) at

   ftp://ftp.cs.unipr.it/pub/ppl/snapshots/

If you can test it, then we will try to solve the remaining problems,
if any.
All the best,

    Roberto

-- 
Prof. Roberto Bagnara
Applied Formal Methods Laboratory
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list