Project

Profile

Help

Distutils error when building Python extension

Added by A D about 2 years ago

  • OS: CentOS 7
  • Python: 3.6
  • Saxon version: HE 11.4

Hello, I'm having an issue with installing SaxonC and I've concluded I'm well out of my depth. I've been able to find non-Saxon related answers to this error message but either it's not applicable to my situation or my hamfisted fix attempts were incorrect.

I've installed SaxonC using all the defaults following the documentation here: https://www.saxonica.com/saxon-c/documentation11/index.html#!starting/installing/installingLinux. This did not throw any errors. The issue I'm having is with this page: https://www.saxonica.com/saxon-c/documentation11/index.html#!starting/installingpython

I've CDed to the ./Saxon.C.API/python-saxon directory and I execute the "python3 saxon-setup.py build_ext -if" command. That results in the following output.

python3 saxon-setup.py build_ext -if
/usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'compiler_directives'
  warnings.warn(msg)
running build_ext
building 'saxonc' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c saxonc.cpp -o build/temp.linux-x86_64-3.6/saxonc.o
In file included from ../SaxonProcessor.h:42:0,
                 from saxonc.cpp:823:
../Xslt30Processor.h:332:5: warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
     void createException(const char * message=nullptr);
     ^
../Xslt30Processor.h:332:47: error: ‘nullptr’ was not declared in this scope
     void createException(const char * message=nullptr);
                                               ^
In file included from ../SaxonProcessor.h:43:0,
                 from saxonc.cpp:823:
../XsltExecutable.h:280:60: error: ‘nullptr’ was not declared in this scope
     void setSaveXslMessage(bool show, const char* filename=nullptr);
                                                            ^
../XsltExecutable.h:378:70: error: ‘nullptr’ was not declared in this scope
     const char* callTemplateReturningString(const char* templateName=nullptr);
                                                                      ^
../XsltExecutable.h:387:67: error: ‘nullptr’ was not declared in this scope
     XdmValue* callTemplateReturningValue(const char* templateName=nullptr);
                                                                   ^
../XsltExecutable.h:433:53: error: ‘nullptr’ was not declared in this scope
     const char * transformToString(XdmNode * source=nullptr);
                                                     ^
../XsltExecutable.h:442:50: error: ‘nullptr’ was not declared in this scope
     XdmValue * transformToValue(XdmNode * source=nullptr);
                                                  ^
../XsltExecutable.h:452:43: error: ‘nullptr’ was not declared in this scope
     void transformToFile(XdmNode * source=nullptr);
                                           ^
In file included from ../SaxonProcessor.h:44:0,
                 from saxonc.cpp:823:
../DocumentBuilder.h:233:51: error: ‘nullptr’ was not declared in this scope
         void createException(const char * message=nullptr);
                                                   ^
In file included from ../SaxonProcessor.h:45:0,
                 from saxonc.cpp:823:
../XQueryProcessor.h:270:47: error: ‘nullptr’ was not declared in this scope
     void createException(const char * message=nullptr);
                                               ^
In file included from ../SaxonProcessor.h:46:0,
                 from saxonc.cpp:823:
../XPathProcessor.h:252:47: error: ‘nullptr’ was not declared in this scope
     void createException(const char * message=nullptr);
                                               ^
In file included from ../SaxonProcessor.h:47:0,
                 from saxonc.cpp:823:
../SchemaValidator.h:85:43: error: ‘nullptr’ was not declared in this scope
   void validate(const char * sourceFile = nullptr);
                                           ^
../SchemaValidator.h:92:54: error: ‘nullptr’ was not declared in this scope
   XdmNode * validateToNode(const char * sourceFile = nullptr);
                                                      ^
In file included from saxonc.cpp:823:0:
../SaxonProcessor.h:426:83: error: ‘nullptr’ was not declared in this scope
     XdmNode *parseXmlFromString(const char *source, SchemaValidator * validator = nullptr);
                                                                                   ^
../SaxonProcessor.h:434:81: error: ‘nullptr’ was not declared in this scope
     XdmNode *parseXmlFromFile(const char *source, SchemaValidator * validator = nullptr);
                                                                                 ^
../SaxonProcessor.h:442:80: error: ‘nullptr’ was not declared in this scope
     XdmNode *parseXmlFromUri(const char *source, SchemaValidator * validator = nullptr);
                                                                                ^
../SaxonProcessor.h:576:73: error: ‘nullptr’ was not declared in this scope
     bool registerCPPFunction(char *libName, JNINativeMethod *gMethods = nullptr) {
                                                                         ^
../SaxonProcessor.h:667:47: error: ‘nullptr’ was not declared in this scope
     void createException(const char * message=nullptr);
                                               ^
../SaxonProcessor.h: In member function ‘bool SaxonProcessor::registerCPPFunction(char*, JNINativeMethod*)’:
../SaxonProcessor.h:577:24: error: ‘nullptr’ was not declared in this scope
         if (libName != nullptr) {
                        ^
../SaxonProcessor.h:582:25: error: ‘nullptr’ was not declared in this scope
         if (gMethods == nullptr && nativeMethodVect.size() == 0) {
                         ^
../SaxonProcessor.h: In static member function ‘static bool SaxonProcessor::registerNativeMethods(JNIEnv*, const char*, JNINativeMethod*, int)’:
../SaxonProcessor.h:609:22: error: ‘nullptr’ was not declared in this scope
         if (clazz == nullptr) {
                      ^
In file included from saxonc.cpp:824:0:
../XdmValue.h: In member function ‘void XdmValue::initialize()’:
../XdmValue.h:194:17: error: ‘nullptr’ was not declared in this scope
     jValues   = nullptr;
                 ^
saxonc.cpp: At global scope:
saxonc.cpp:3487:14: warning: ‘char* __pyx_f_6saxonc_make_c_str2(PyObject*, __pyx_opt_args_6saxonc_make_c_str2*)’ defined but not used [-Wunused-function]
 static char *__pyx_f_6saxonc_make_c_str2(PyObject *__pyx_v_str_value, struct __pyx_opt_args_6saxonc_make_c_str2 *__pyx_optional_args) {
              ^
error: command 'gcc' failed with exit status 1

My searching revealed something about setuptools being recommended instead of disttutils (example: https://stackoverflow.com/questions/8295644/pypi-userwarning-unknown-distribution-option-install-requires), but my attempt to replace calls for distutils with setuptools did not resolve the issue.

Is it possible to download a built version of the Python extension? I'll be the first to admit I'm not entirely sure what I'm doing so I'm not sure if that's even possible.

Thank you for your time.


Replies (9)

Please register to reply

RE: Distutils error when building Python extension - Added by Martin Honnen about 2 years ago

Just to be sure, did you install Cython?

Also, can you install something like sudo apt-get install python3-dev on CentOS?

RE: Distutils error when building Python extension - Added by Martin Honnen about 2 years ago

Perhaps doing e.g. dnf install python36-devel.x86_64 is possible and helps?

RE: Distutils error when building Python extension - Added by O'Neil Delpratt about 2 years ago

From the error:

‘nullptr’ was not declared in this scope

It maybe C++14 is not enabled. Please check your g++ version installed on your machine.

RE: Distutils error when building Python extension - Added by A D about 2 years ago

pip3 install Cython
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: Cython in /usr/local/lib64/python3.6/site-packages (0.29.32)

sudo yum install python3-devel
Package python3-devel-3.6.8-18.el7.x86_64 already installed and latest version

gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Based on some quick searching gcc 4.8.5 is the default version that ships with CentOS 7. Using the instructions at https://stackoverflow.com/questions/55345373/how-to-install-gcc-g-8-on-centos I got it up to 8.3.1 20190311. Rerunning the build_ext command yields different output and a new file called "saxonc.cpython-36m-x86_64-linux-gnu.so". Is that a success? The documentation for the Python extension doesn't say and my development experience is a 10 year old Android programming class.

New output:

python3 saxon-setup.py build_ext -if
/usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'compiler_directives'
  warnings.warn(msg)
running build_ext
building 'saxonc' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c saxonc.cpp -o build/temp.linux-x86_64-3.6/saxonc.o
saxonc.cpp:3487:14: warning: ‘char* __pyx_f_6saxonc_make_c_str2(PyObject*, __pyx_opt_args_6saxonc_make_c_str2*)’ defined but not used [-Wunused-function]
 static char *__pyx_f_6saxonc_make_c_str2(PyObject *__pyx_v_str_value, struct __pyx_opt_args_6saxonc_make_c_str2 *__pyx_optional_args) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../SaxonProcessor.cpp -o build/temp.linux-x86_64-3.6/../SaxonProcessor.o
../SaxonProcessor.cpp: In member function ‘XdmArray* SaxonProcessor::makeArray(XdmValue**, int)’:
../SaxonProcessor.cpp:1186:17: warning: unused variable ‘obj2’ [-Wunused-variable]
         jobject obj2 = nullptr;
                 ^~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../SaxonApiException.cpp -o build/temp.linux-x86_64-3.6/../SaxonApiException.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../SaxonCGlue.c -o build/temp.linux-x86_64-3.6/../SaxonCGlue.o
../SaxonCGlue.c: In function ‘setParameter’:
../SaxonCGlue.c:524:24: warning: argument 1 null where non-null expected [-Wnonnull]
         namespaceLen = strlen(namespacei);
                        ^~~~~~~~~~~~~~~~~~
In file included from ../SaxonCGlue.h:16,
                 from ../SaxonCGlue.c:1:
/usr/include/string.h:395:15: note: in a call to function ‘strlen’ declared here
 extern size_t strlen (const char *__s)
               ^~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../SaxonCXPath.c -o build/temp.linux-x86_64-3.6/../SaxonCXPath.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmValue.cpp -o build/temp.linux-x86_64-3.6/../XdmValue.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmItem.cpp -o build/temp.linux-x86_64-3.6/../XdmItem.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmNode.cpp -o build/temp.linux-x86_64-3.6/../XdmNode.o
In file included from ../XdmNode.cpp:3:
../XdmNode.h: In constructor ‘XdmNode::XdmNode(jobject)’:
../XdmNode.h:265:6: warning: ‘XdmNode::childCount’ will be initialized after [-Wreorder]
  int childCount; /*!< The number of of child nodes on the current node*/
      ^~~~~~~~~~
../XdmNode.h:264:13: warning:   ‘XdmNode** XdmNode::children’ [-Wreorder]
  XdmNode ** children; /*!< Cached. Child nodes when getChildren method is first called; */
             ^~~~~~~~
../XdmNode.cpp:9:1: warning:   when initialized here [-Wreorder]
 XdmNode::XdmNode(jobject obj): XdmItem(obj), baseURI(nullptr), nodeName(nullptr),localName(nullptr), childCount(-1), children(nullptr),parent(nullptr), typedValue(nullptr), attrValues(nullptr), attrCount(-1), nodeKind(UNKNOWN){
 ^~~~~~~
In file included from ../XdmNode.cpp:3:
../XdmNode.h: In constructor ‘XdmNode::XdmNode(XdmNode*, jobject, XDM_NODE_KIND)’:
../XdmNode.h:265:6: warning: ‘XdmNode::childCount’ will be initialized after [-Wreorder]
  int childCount; /*!< The number of of child nodes on the current node*/
      ^~~~~~~~~~
../XdmNode.h:264:13: warning:   ‘XdmNode** XdmNode::children’ [-Wreorder]
  XdmNode ** children; /*!< Cached. Child nodes when getChildren method is first called; */
             ^~~~~~~~
../XdmNode.cpp:13:1: warning:   when initialized here [-Wreorder]
 XdmNode::XdmNode(XdmNode * p, jobject obj, XDM_NODE_KIND kind): XdmItem(obj), baseURI(nullptr), nodeName(nullptr), localName(nullptr),  childCount(-1), children(nullptr), parent(p), typedValue(nullptr), attrValues(nullptr),  attrCount(-1), nodeKind(kind){}
 ^~~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmAtomicValue.cpp -o build/temp.linux-x86_64-3.6/../XdmAtomicValue.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmMap.cpp -o build/temp.linux-x86_64-3.6/../XdmMap.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmArray.cpp -o build/temp.linux-x86_64-3.6/../XdmArray.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XdmFunctionItem.cpp -o build/temp.linux-x86_64-3.6/../XdmFunctionItem.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../Xslt30Processor.cpp -o build/temp.linux-x86_64-3.6/../Xslt30Processor.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XsltExecutable.cpp -o build/temp.linux-x86_64-3.6/../XsltExecutable.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XQueryProcessor.cpp -o build/temp.linux-x86_64-3.6/../XQueryProcessor.o
../XQueryProcessor.cpp: In member function ‘void XQueryProcessor::declareNamespace(const char*, const char*)’:
../XQueryProcessor.cpp:130:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::map<std::basic_string<char>, std::basic_string<char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
              if(s == properties.size()) {
                 ~~^~~~~~~~~~~~~~~~~~~~
../XQueryProcessor.cpp: In member function ‘void XQueryProcessor::executeQueryToFile(const char*, const char*, const char*)’:
../XQueryProcessor.cpp:298:8: warning: unused variable ‘checkCast’ [-Wunused-variable]
   bool checkCast = SaxonProcessor::sxn_environ->env->IsInstanceOf((iter->second)->getUnderlyingValue(), lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmValueForCpp") );
        ^~~~~~~~~
../XQueryProcessor.cpp: In member function ‘XdmValue* XQueryProcessor::executeQueryToValue(const char*, const char*)’:
../XQueryProcessor.cpp:361:8: warning: unused variable ‘checkCast’ [-Wunused-variable]
   bool checkCast = SaxonProcessor::sxn_environ->env->IsInstanceOf((iter->second)->getUnderlyingValue(), lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmValueForCpp") );
        ^~~~~~~~~
../XQueryProcessor.cpp: In member function ‘const char* XQueryProcessor::executeQueryToString(const char*, const char*)’:
../XQueryProcessor.cpp:464:8: warning: unused variable ‘checkCast’ [-Wunused-variable]
   bool checkCast = SaxonProcessor::sxn_environ->env->IsInstanceOf((iter->second)->getUnderlyingValue(), lookForClass(SaxonProcessor::sxn_environ->env, "net/sf/saxon/option/cpp/XdmValueForCpp") );
        ^~~~~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../XPathProcessor.cpp -o build/temp.linux-x86_64-3.6/../XPathProcessor.o
../XPathProcessor.cpp: In member function ‘void XPathProcessor::setProperty(const char*, const char*)’:
../XPathProcessor.cpp:530:8: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::map<std::basic_string<char>, std::basic_string<char> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   if(s == properties.size()) {
      ~~^~~~~~~~~~~~~~~~~~~~
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../SchemaValidator.cpp -o build/temp.linux-x86_64-3.6/../SchemaValidator.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I. -I../jni -I../jni/unix -I/usr/include/python3.6m -c ../DocumentBuilder.cpp -o build/temp.linux-x86_64-3.6/../DocumentBuilder.o
g++ -pthread -shared -Wl,-z,relro -g build/temp.linux-x86_64-3.6/saxonc.o build/temp.linux-x86_64-3.6/../SaxonProcessor.o build/temp.linux-x86_64-3.6/../SaxonApiException.o build/temp.linux-x86_64-3.6/../SaxonCGlue.o build/temp.linux-x86_64-3.6/../SaxonCXPath.o build/temp.linux-x86_64-3.6/../XdmValue.o build/temp.linux-x86_64-3.6/../XdmItem.o build/temp.linux-x86_64-3.6/../XdmNode.o build/temp.linux-x86_64-3.6/../XdmAtomicValue.o build/temp.linux-x86_64-3.6/../XdmMap.o build/temp.linux-x86_64-3.6/../XdmArray.o build/temp.linux-x86_64-3.6/../XdmFunctionItem.o build/temp.linux-x86_64-3.6/../Xslt30Processor.o build/temp.linux-x86_64-3.6/../XsltExecutable.o build/temp.linux-x86_64-3.6/../XQueryProcessor.o build/temp.linux-x86_64-3.6/../XPathProcessor.o build/temp.linux-x86_64-3.6/../SchemaValidator.o build/temp.linux-x86_64-3.6/../DocumentBuilder.o -L/usr/lib64 -lpython3.6m -o /home/yvc7970/libsaxon-HEC-11.4/Saxon.C.API/python-saxon/saxonc.cpython-36m-x86_64-linux-gnu.so

Thank you for the rapid responses! I was worried I'd be waiting for weeks.

RE: Distutils error when building Python extension - Added by Martin Honnen about 2 years ago

If the saxonc.cpython-36m-x86_64-linux-gnu.so has been created then, as far as I know it from Linux, the Python extension of SaxonC has been created. So I think that is success, yes.

RE: Distutils error when building Python extension - Added by Martin Honnen about 2 years ago

Try running one of the samples saxon_example.py, saxon_example2.py and saxon_example3.py in that directory e.g. python3 saxon_example2.py.

RE: Distutils error when building Python extension - Added by A D about 2 years ago

Yes, that worked! Thank you both.

Last question: I presume the newly created .so file should be moved to /usr/lib along with the other files (like libsaxonhec.so). Is that correct?

RE: Distutils error when building Python extension - Added by Martin Honnen about 2 years ago

I am usually keeping that file in the directory where it was built and then make sure I set PYTHONPATH to include that directory. That works for me to run my Python code importing saxonc.

But I don't know what is the established or proper way to store such files on Linux or CentOS, in the end what matters is that Python can find the module.

RE: Distutils error when building Python extension - Added by O'Neil Delpratt about 2 years ago

Checkout the following link might help: https://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch28s04.html

As Martin suggested adding to the PYTHONPATH environment variable to the location where you install the library works. Or even placing the library in the default location for python libraries.

    (1-9/9)

    Please register to reply