Menu

#612 [pytango][8.0.3] failed to build from source on s390

closed-fixed
nobody
None
PyTango
5
2013-11-22
2013-05-30
No

I know I know nobody cares about s390 but on this platform we got this error during the build

/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp:691:25: instantiated from here
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute_numpy.hpp:242:42: error: invalid initialization of reference of type 'Py_ssize_t& {aka long int&}' from expression of type 'npy_intp {aka int}'
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute_numpy.hpp:243:42: error: invalid initialization of reference of type 'Py_ssize_t& {aka long int&}' from expression of type 'npy_intp {aka int}'
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp: In function 'void PyDeviceAttribute::_fill_list_attribute(Tango::DeviceAttribute&, bool, const boost::python::api::object&) [with long int tangoTypeConst = 2l]':
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp:693:25: instantiated from here
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp:627:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp: In function 'void PyDeviceAttribute::_fill_list_attribute(Tango::DeviceAttribute&, bool, const boost::python::api::object&) [with long int tangoTypeConst = 3l]':
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp:693:25: instantiated from here
/build/buildd-pytango_8.0.3-1-s390-5JWxzh/pytango-8.0.3/src/boost/cpp/device_attribute.cpp:627:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Indeed on this patform Py_ssize_t is a long int and npy_intp is a int..

the warning is just because I hate warning during the build :)

Cheers

Fred

Discussion

  • Frédéric PICCA

    Just for information this bug will block the migration of pytango AND tango into Debian testing.

     
  • Emmanuel Taurel

    Emmanuel Taurel - 2013-06-06
    • Category: --> PyTango
     
  • Frédéric PICCA

    Hello Tiago,

    I try to understand the problem, so here is the offending code.
    So npy_intp and Py_ssize_t are different on powerpc. I do not know why but
    this is a fact.
    Now I do not understant the comment about the isImage.
    Why do you want to know the coordinates x and y ? can't you just push the data in the buffer the way they are filled in the numpy array.
    to my opinion the code for the spectrum should work also for the image but instead of using coordinates you could use the total number of elements of the array.

    Did I missed something ?

       if (isImage) {
            // Why not use PyArray_ITER_NEXT() instead of PyArray_ITER_GOTO()?
            // We could do a single while(iter->index < iter->size) instead
            // of the double "for".
            // I did this and it worked in the sense that it went across
            // the correct number of elements but... I did not know the
            // x and y position it corresponded! Yes, 'iter' has a coordinates
            // field, but it was always [0,0], never updated!!
            npy_intp coordinates[2];
            Py_ssize_t &x = coordinates[1];
            Py_ssize_t &y = coordinates[0];
            for (y=0; y < dim_y; ++y) {
                for (x=0; x < dim_x; ++x) {
                    PyArray_ITER_GOTO(iter, coordinates);
    
                    PyObject* dataObj = PyArray_GETITEM(array, iter->dataptr);
                    const object py_data = object( handle<>( dataObj ) );
    
                    buffer[y*dim_x + x] = extract<TangoScalarType>(py_data);
                }
            }
        } else {
            for (Py_ssize_t x=0; x < dim_x; ++x) {
                PyObject* dataObj = PyArray_GETITEM(array, iter->dataptr);
                const object py_data = object( handle<>( dataObj ) );
    
                buffer[x] = extract<TangoScalarType>(py_data);
    
                PyArray_ITER_NEXT(iter);
            }
        }
    

    Cheers

    Fred

     
    • Tiago Coutinho

      Tiago Coutinho - 2013-07-09

      Hi Frederic,

      In fact I did not write the comment. It seems a little strange indeed.
      I trust the guy who did it (Ramon Sune) so I prefer to leave it like that and do the fix with a simple cast for now.

      Anyway I am thinking of trying to remove all numpy dependencies on C++ level so this code will disapeear in the future (if everything goes well :-)

       
  • Frédéric PICCA

    proposed patch

    can you confirm that it is ok ?

     
    • Tiago Coutinho

      Tiago Coutinho - 2013-07-09

      Hi Frederic,

      I fixed it before seeing your proposed patch with a simple data type cast.
      Sorry for that.

       
  • Tiago Coutinho

    Tiago Coutinho - 2013-07-09
    • status: open --> open-fixed
     
  • Tiago Coutinho

    Tiago Coutinho - 2013-07-09

    Hello,

    Fixed in SVN trunk since revision #23071
    Will become visible in next PyTango 8.0.4

     
  • Tiago Coutinho

    Tiago Coutinho - 2013-08-28
    • status: open-fixed --> closed
    • assigned_to: Coutinho --> nobody
     
  • Tiago Coutinho

    Tiago Coutinho - 2013-11-22
    • status: closed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB