Closed gevero closed 8 years ago
It works fine for me with python 3.4 (and also 3.5), both on Linux and OS X. My guess is that scuff-python.cpp (generated by swig based on scuff-python.i) should be regenerated. You could try deleting scuff-python.cpp (and maybe configuring with "--enable-maintainer-mode").
I must admit that my ignorance does not allow my to fully understand your comment. What I understand is:
By the way i am using anaconda3
Thanks a lot
Giovanni
I followed your advice, but I am getting the same error. I guess if the error is caused by the old compiler more that by code itself. My gcc is 4.4.7.
Sorry if my previous message was a bit cryptic, I was about to go to a meeting and wrote in a bit of a rush. To answer your questions (according to my understanding - I'm a user of scuff-em, not the developer):
So if you are compiling from a "clean" checkout and scuff-python.cpp was created, I'm not sure why it's not working. Which version of swig are you using, and is it from anaconda or from the system linux? If it's from the system, you could try installing the one from anaconda ("conda install swig"), which is probably newer (I have swig 3.0.2 from anaconda on linux, and it works for me).
Johannes, thanks for weighing in, and you are right about the build process.
Is it possible that the two different versions of python on your system are both being used at different times in the same build? For example, maybe scuff-python.cpp
is getting built to work with python 2.7, but then something later in the build process is using python 3.4? Maybe check the configure logs and logs from the build process?
As far as I know, swig is independent of the python version/distribution. It is not a part of python, and does not itself look for or use python headers etc. The generated .cpp file contains some #if statements that check the python version, such as
/* Compatibility macros for Python 3 */
#if PY_VERSION_HEX >= 0x03000000
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
...
So the swig-generated .cpp file should compile with any version of python. However, my guess is that the swig version has to be new enough to generate a header compatible with newer pythons (hence my question about the version of swig Giovanni is using).
(Note that you can pass -py3 as an extra flag to swig, but that only turns on some features that are only supported in python 3, so the .cpp then will not compile with python 2. The flag is not necessary to get a .cpp that is compatible with python 3).
The issue is solved:
Thanks a lot!!!
While compiling scuff-em on my linux box, python interface compiles successfully only under python 2.7. The arising errors with python 3.4 (the ones I was able to find at least) are as follows:
scuff-python.cpp:2452: error: ‘PyCObject_Import’ was not declared in this scope scuff-python.cpp:2521: error: ‘PyCObject_FromVoidPtr’ was not declared in this scope scuff-python.cpp:2544: error: ‘PyCObject_AsVoidPtr’ was not declared in this scope scuff-python.cpp:2549: error: ‘PyCObject_FromVoidPtr’ was not declared in this scope scuff-python.cpp:2901: error: ‘PyString_Check’ was not declared in this scope
Best
Giovanni