SopiMlab/py

Error to compile in Windows

Opened this issue · 1 comments

Hi, I am trying to compile it for Windows, and I am having this error:

C:/Users/Neimog/AppData/Local/Programs/Python/Python310/include/moduleobject.h:28:45: note: declared here
   28 | Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
      |                                             ^~~~~~~~~~~~~~~~~~~~
source/pybase.cpp:425:15: error: cast from 'HINSTANCE' {aka 'HINSTANCE__*'} to 'int' loses precision [-fpermissive]
  425 |     int err = (int)ShellExecute(NULL,"edit",fname,NULL,NULL,SW_SHOW);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source/pybase.cpp:428:15: error: cast from 'HINSTANCE' {aka 'HINSTANCE__*'} to 'int' loses precision [-fpermissive]
  428 |         err = (int)ShellExecute(NULL,NULL,"notepad.exe",fname,NULL,SW_SHOW);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source/pybase.cpp: In member function 'void pybase::Reload()':
source/pybase.cpp:793:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  793 |             pybase *th = (pybase *)PyLong_AsLong(key);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
source/pybase.cpp:812:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  812 |                 pybase *th = (pybase *)PyLong_AsLong(key);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
source/pybase.cpp: In static member function 'static PyObject* pybase::StdOut_Write(PyObject*, PyObject*)':
source/pybase.cpp:827:42: warning: unused parameter 'self' [-Wunused-parameter]
  827 | PyObject* pybase::StdOut_Write(PyObject* self, PyObject* args)
      |                                ~~~~~~~~~~^~~~
source/pybase.cpp: In static member function 'static PyObject* pybase::StdOut_Flush(PyObject*, PyObject*)':
source/pybase.cpp:906:42: warning: unused parameter 'self' [-Wunused-parameter]
  906 | PyObject* pybase::StdOut_Flush(PyObject* self, PyObject* args)
      |                                ~~~~~~~~~~^~~~
source/pybase.cpp:906:58: warning: unused parameter 'args' [-Wunused-parameter]
  906 | PyObject* pybase::StdOut_Flush(PyObject* self, PyObject* args)
      |                                                ~~~~~~~~~~^~~~
make: *** [pd-lib-builder//Makefile.pdlibbuilder:955: source/pybase.o] Erro 1

Could someone help me? The project to update py to python 3 would is great.

I am trying to compile it using Windows 11, 64 bits I am in mingw64, and I add the

cpp.flags := -DPD -I "$(PDINCLUDEDIR)" $(cpp.flags) $(CPPFLAGS) -I"C:/Users/Neimog/Downloads/flext/source/" -I"C:/Users/Neimog/AppData/Local/Programs/Python/Python310/include/"

in Makefile.pdlibbuilder.

Thank you very much!

If I comment the #if FLEXT_OS == FLEXT_OS_WIN:

#if FLEXT_OS == FLEXT_OS_WIN
    post("Not implemented on Windows!");
    
    // int err = (int)ShellExecute(NULL,"edit",fname,NULL,NULL,SW_SHOW);
    // if(err == SE_ERR_NOASSOC) {
    //     // no association found - try notepad
    //     post("Not implemented on Windows!");
    //     //err = (int)ShellExecute(NULL,NULL,"notepad.exe",fname,NULL,SW_SHOW);
    // }
    // else if(err == ERROR_FILE_NOT_FOUND || err == SE_ERR_FNF)
    //     post("py/pyext - File not %s found",fname);
    // else if(err <= 32)
    //     post("py/pyext - Unknown error opening %s",fname);

then I am able to compile pybase but pybuffer I get error:

source/pybuffer.cpp: In function 'long int buffer_hash(PyObject*)':
source/pybuffer.cpp:149:12: error: cast from 'flext_single<void>::buffer*' to 'long int' loses precision [-fpermissive]
  149 |     return (long)(((pySamplebuffer *)self)->buf);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
source/pybuffer.cpp: In function 'int buffer_getbuffer(PyObject*, Py_buffer*, int)':
source/pybuffer.cpp:261:54: error: 'PY_NUMPY_BUFFER_FORMAT' was not declared in this scope
  261 |     view->format = (flags & PyBUF_FORMAT) ? (char *) PY_NUMPY_BUFFER_FORMAT : NULL;
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~
source/pybuffer.cpp: At global scope:
source/pybuffer.cpp:1037:5: error: invalid conversion from 'long int (*)(PyObject*)' {aka 'long int (*)(_object*)'} to 'hashfunc' {aka 'long long int (*)(_object*)'} [-fpermissive]
 1037 |     buffer_hash,               /*tp_hash */
      |     ^~~~~~~~~~~
      |     |
      |     long int (*)(PyObject*) {aka long int (*)(_object*)}
make: *** [pd-lib-builder//Makefile.pdlibbuilder:955: source/pybuffer.o] Erro 1