Project

Profile

Help

Bug #4531

Saxon-HEC1.1.2 - issues with installation on linux64 (persistent jni errors) and question concerning python extension

Added by Lars Möller 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Category:
Python
Start date:
2020-04-28
Due date:
% Done:

0%

Estimated time:
Found in version:
Saxon-HEC1.1.2
Fixed in version:

Description

Hello,

I would like to perform (fairly simple) xsl transformations on large amounts of small xml files in python, and, due to the lack of XSL >2.0 support in common python implementations like lxml, hoped to achieve this task with the help of the Saxon/C Home Edition.

Unfortunately I am facing an incistent issue with jni (took me half a day before I finally gave up) when I try running one of the provided samples as suggested in here, indicating something is wrong with my installation. But before I dive deeper into this issue I'd rather ask something concerning the intended application in python.

Will I be able to use the python extension with the Home Edition once I'd get it up and running, or would I need to upgrade to one of the other product lines?

The descriptions on the Saxonica web page and the Feature Matrix imply (at least for me) there would be no restrictions in the HE in terms of the use of the python implementation. But, despite the python extension docs state that "The Python extension is held in the directory Saxon.C.API/python-saxon.", however, no such directory was created during the installation procedure - neither in v1.1.2 nor v1.0.2. Hence, I anticipate the wanted extension is only available in EE and PE?! Or am I wrong?

Thank you!

Best regards, Lars

PS: Here is what I get when trying to run the provided samples:

… In file included from ../../Saxon.C.API/SaxonCGlue.c:1:0: ../../Saxon.C.API/SaxonCGlue.h:11:10: fatal error: jni.h: Datei oder Verzeichnis nicht gefunden #include <jni.h> ^~~~~~~ compilation terminated. In file included from ../../Saxon.C.API/SaxonCProcessor.h:4:0, from ../../Saxon.C.API/SaxonCXPath.h:4, from ../../Saxon.C.API/SaxonCXPath.c:1: ../../Saxon.C.API/SaxonCGlue.h:11:10: fatal error: jni.h: Datei oder Verzeichnis nicht gefunden …

saxon-setup_build.log (13.4 KB) saxon-setup_build.log Lars Möller, 2020-04-29 09:42

History

#1 Updated by O'Neil Delpratt 4 months ago

Hi Lars,

It looks like you have an old version of Saxon/C. The python extension was added in the Saxon/C 1.2 series release and is available for all the Saxon products (i.e. HE, PE and EE).

See the download page for the latest Saxon/C release: https://www.saxonica.com/download/c.xml

#2 Updated by O'Neil Delpratt 4 months ago

  • Status changed from New to AwaitingInfo

#3 Updated by Lars Möller 4 months ago

Hey O'Neil Delpratt,

thank you for your quick reply. Good to know that there is a chance to get it working. Unfortunately I could'nt get back to this earlier.

I downloaded the latest linux64 binary just yesterday. I only wanted to make sure that the preceeding version did not contain the extension while the docs were outdated or alike. I will delete v1.0.2 now.

My issues arose solely with this latest version. I installed it as advised, but chose $HOME for installation location as my machine is a single user device.

Basically, I have two issues to solve:

  1. the build64-linux.sh script struggles to find jni.h and aborts the compilation of test samples with 10-12 errors like

    ../../Saxon.C.API/SaxonCGlue.h:11:10: fatal error: jni.h: Datei oder Verzeichnis nicht gefunden
    #include <jni.h>
    ^~~~~~~
    compilation terminated.
    In file included from ../../Saxon.C.API/SaxonProcessor.h:32:0, from ../../Saxon.C.API/XdmValue.h:13, from ../../Saxon.C.API/XdmItem.h:11, from ../../Saxon.C.API/XdmItem.cpp:3:
    ../../Saxon.C.API/SaxonCGlue.h:11:10: fatal error: jni.h: Datei oder Verzeichnis nicht gefunden

    … and a bunch of these (~25):

    g++: error: bin/SaxonCGlue.o: Datei oder Verzeichnis nicht gefunden

    I tried:

    • softlinking included jni.h and companion file to $PATH locations, to .../Saxonica/Saxon-HEC1.1.2/Saxon.C.API, $HOME/.local/bin/ and other places
    • checked its execution rights
    • export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ after I installed openjdk-11-source as an alternative source for jni
    • export JAVA_INCLUDE_DIR=/usr/lib/jvm/java-11-openjdk-amd64/include/
    • exported:

CPLUS_INCLUDE_PATH=/usr/lib/rt/amd64:$JAVA_HOME/include/linux:$JAVA_HOME/include CPLUS_INCLUDE_PATH=$HOME.local/bin/rt/amd64:$JAVA_HOME/include/linux:$JAVA_HOME/include CPLUS_INCLUDE_PATH=$HOME.local/bin/rt/amd64:$JAVA_HOME/include/linux:$JAVA_HOME/include:$HOMEDevelopment/Saxonica/Saxon-HEC1.1.2/Saxon.C.API/jni/ and what not

During all this fiddling, the amount of error messages decreased to the remaining:

In file included from ../../Saxon.C.API/SaxonCGlue.c:1:0:
../../Saxon.C.API/SaxonCGlue.h:11:10: fatal error: jni.h: Datei oder Verzeichnis nicht gefunden
#include <jni.h>
^~~~~~~
compilation terminated.
In file included from ../../Saxon.C.API/SaxonCProcessor.h:4:0,
from ../../Saxon.C.API/SaxonCXPath.h:4,
from ../../Saxon.C.API/SaxonCXPath.c:1:
../../Saxon.C.API/SaxonCGlue.h:11:10: fatal error: jni.h: Datei oder Verzeichnis nicht gefunden
#include <jni.h>
^~~~~~~
compilation terminated.
g++: error: bin/SaxonCGlue.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCXPath.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCGlue.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCXPath.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCGlue.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCXPath.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCGlue.o: Datei oder Verzeichnis nicht gefunden
g++: error: bin/SaxonCXPath.o: Datei oder Verzeichnis nicht gefunden

I don't know how good your German is but "Datei oder Verzeichnis nicht gefunden" translates to "file or directory not found" - you might have guessed it ;-)

  1. There is no trace of a python-saxon directory in Saxon.C.API as mentioned in the respective documentation or anywhere in the installation path.

Any suggestions or help is very much appreciated. Thank you!

O'Neil Delpratt wrote:

Hi Lars,

It looks like you have an old version of Saxon/C. The python extension was added in the Saxon/C 1.2 series release and is available for all the Saxon products (i.e. HE, PE and EE).

See the download page for the latest Saxon/C release: https://www.saxonica.com/download/c.xml

#4 Updated by O'Neil Delpratt 4 months ago

With Saxon/C 1.1.2 you can easily run into these issue. In this release you have to set the path to jni header files.

However in Saxon/C 1.2 you won't run into these issues as we now supply the jni header files with the product. Referencing is done locally in the C++ files so that you don't have to set it via the class path.

#5 Updated by Lars Möller 4 months ago

How embarrassing - I repeatedly read 1.1.2 instead of 1.2.1 in your answers and in the link you provided yesterday.

My apologies! I'll try 1.2.1 now. Thanks

O'Neil Delpratt wrote:

With Saxon/C 1.1.2 you can easily run into these issue. In this release you have to set the path to jni header files.

However in Saxon/C 1.2 you won't run into these issues as we now supply the jni header files with the product. Referencing is done locally in the C++ files so that you don't have to set it via the class path.

#6 Updated by Lars Möller 4 months ago

Ok, it worked out better this time. A few warnings were thrown, but I suppose it is nothing critical:

  • running the sample build script:

../../Saxon.C.API/XdmValue.cpp: In constructor ‘XdmValue::XdmValue(jobject, bool)’: ../../Saxon.C.API/XdmValue.cpp:74:38: warning: unused parameter ‘arr’ [-Wunused-parameter] XdmValue::XdmValue(jobject val, bool arr){ ^~~ testXSLT30.cpp: In function ‘void exampleSimple_xmark(Xslt30Processor*, sResultCount*)’: testXSLT30.cpp:674:64: warning: unused parameter ‘sresult’ [-Wunused-parameter] void exampleSimple_xmark(Xslt30Processor proc, sResultCount sresult){ ^~~~~~~ testXSLT30.cpp: In function ‘void testResolveUri(SaxonProcessor, Xslt30Processor, sResultCount*)’: testXSLT30.cpp:808:38: warning: unused parameter ‘proc’ [-Wunused-parameter] void testResolveUri(SaxonProcessor * proc, Xslt30Processor * trans, sResultCount * sresult) { ^~~~ testXSLT30.cpp: In function ‘void testPipeline(SaxonProcessor*, sResultCount*)’: testXSLT30.cpp:920:57: warning: unused parameter ‘sresult’ [-Wunused-parameter] void testPipeline(SaxonProcessor * proc, sResultCount * sresult){ ^~~~~~~ testXPath.cpp: In function ‘void testXPathOnFile(SaxonProcessor*, XPathProcessor*)’: testXPath.cpp:117:39: warning: unused parameter ‘processor’ [-Wunused-parameter] void testXPathOnFile(SaxonProcessor * processor, XPathProcessor * xpath){ ^~~~~~~~~

  • the ./buildhec-command.sh for commands

Transform.c: In function ‘checkForException’: Transform.c:234:2: warning: format not a string literal and no format arguments [-Wformat-security] printf(utfName); ^~~~~~ Query.c: In function ‘checkForException’: Query.c:232:2: warning: format not a string literal and no format arguments [-Wformat-security] printf(utfName); ^~~~~~

  • and I found something supposedly unwanted in the script ./testXSLT in cpp

Test: XsltProcessor with Saxon version=Saxon/C 1.2.1 running with Saxon-HE 9.9.1.5C from Saxonica

Error I/O error reported by XML parser processing /home/ond1/work/svn/latest9.9-saxonc/samples/php/catalog-test/test1.xsl: Datei oder Verzeichnis nicht gefunden …

Thanks for the guide! I propose we close this issue.

#7 Updated by O'Neil Delpratt 4 months ago

Great that you got it working. It looks like you are running the C++ samples. For python I suggest you follow the instructions given here: Installing Saxon/C Python extension

#8 Updated by Lars Möller 4 months ago

That was only for testing - followed the instructions for python and it finished with a few warnings (see attachment) but again no critical error.

I try to implement it this afternoon - if you don't mind I'll get back to you if I get stuck somewhere.

Thanks again!

#9 Updated by O'Neil Delpratt 4 months ago

  • Status changed from AwaitingInfo to Closed

Great! I will close this bug.

Please register to edit this issue

Also available in: Atom PDF