[foreign] Instructions for using libraries on Windows

Jorn Vernee jbvernee at xs4all.nl
Thu Jan 17 21:17:49 UTC 2019


This also has been fixed in the TensorFlow recently: 
https://github.com/tensorflow/tensorflow/commit/ceee617b3675037da8637997f673ab9a993ee5de

So this should not be a problem anymore once this change makes it into 
the binary distributions.

Jorn

Jorn Vernee schreef op 2019-01-17 22:13:
> FWIW, I've investigated the stack overflow with Tensorflow, and it
> seems to be caused by a template type in the standard C++ library on
> Windows (since we're running in C++ mode).
> 
> As a workaround we can manually fix the function prototypes in
> `c_api.h` needed for the example:
> 
>     TF_Version() -> TF_Version(void)
>     TF_NewGraph() -> TF_NewGraph(void)
>     TF_NewSessionOptions() -> TF_NewSessionOptions(void)
>     TF_NewStatus() -> TF_NewStatus(void)
> 
> After that jextract succeeds without using the extra Clang flags, and
> the example seems to work as well.
> 
> Jorn
> 
> Jorn Vernee schreef op 2019-01-17 17:36:
>> Hi,
>> 
>> I have updated panama_foreign.md with instructions for jextracting and
>> running OpenGL and Python. I have also tried other Windows applicable
>> libraries, here were the issues:
>> 
>> LAPACK & BLAS: require libgfortran-3 as a dependency, which I couldn't
>> find a binary distro for so quickly. (MINGW has a package for it, but
>> only libgfortran-4)
>> 
>> Tensorflow: is crashing jextract with a stack overflow error.
>> 
>> ```
>>     Exception in thread "main" java.lang.StackOverflowError
>>         at
>> jdk.internal.clang/jdk.internal.clang.StructType.<init>(StructType.java:37)
>>         at
>> jdk.internal.clang/jdk.internal.clang.StructType.<init>(StructType.java:32)
>>         at 
>> jdk.internal.clang/jdk.internal.clang.Type.<init>(Type.java:30)
>>         at
>> jdk.internal.clang/jdk.internal.clang.Type.canonicalType(Native
>> Method)
>>         at
>> jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:134)
>>         at
>> jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:134)
>>         at
>> jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:134)
>>         at
>> jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:134)
>>         ...
>> ```
>> 
>> FWIW, you made a note about needing to pass `-C -c -C c++` to jextract
>> so it doesn't interpret some methods as varargs. I've tried without
>> those flags and am observing the same vararg problem, but in that case
>> extraction does succeed.
>> 
>> The other libraries libproc, readline, and unistd don't seem
>> applicable to Windows. I will be on the lookout for Windows specific
>> examples that could be interesting.
>> 
>> The `make update-build-doc` does not work on windows [1], so I ask
>> that you generate the .html dos for me instead.
>> 
>> Here is the updated panama_foreign.md:
>> http://cr.openjdk.java.net/~jvernee/panama/panama_foreign.md
>> 
>> Jorn
>> 
>> [1] : 
>> https://mail.openjdk.java.net/pipermail/build-dev/2019-January/024666.html


More information about the panama-dev mailing list