Skip to content

winXP 32-bit build problems #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
reckoner opened this issue Dec 7, 2011 · 7 comments
Closed

winXP 32-bit build problems #458

reckoner opened this issue Dec 7, 2011 · 7 comments
Labels
Build Library building on various platforms
Milestone

Comments

@reckoner
Copy link

reckoner commented Dec 7, 2011

trouble building latest tip on winxp 32:

  running build
  running build_py
  copying pandas\version.py -> build\lib.win32-2.6\pandas
  running build_ext
  skipping 'pandas\src\tseries.c' Cython extension (up-to-date)
  building 'pandas._tseries' extension
  C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python26\lib\site-packages\numpy-1.6.1-py2.6-win32.egg\numpy\core\include -IC:\Python26\include -IC:\Python26\PC /Tcpandas\src\tseries.c /Fobuild\temp.win32-2.6\Release\pandas\src\tseries.obj
  tseries.c
  c:\documents and settings\reckoner\desktop\pandas\pandas\src\numpy_helper.h(29) : error C2036: 'void *' : unknown size
  pandas\src\tseries.c(25741) : warning C4244: 'function' : conversion from '__pyx_t_5numpy_int64_t' to 'Py_ssize_t', possible loss of data
  pandas\src\tseries.c(27030) : warning C4244: 'function' : conversion from '__pyx_t_5numpy_int64_t' to 'Py_ssize_t', possible loss of data
  pandas\src\tseries.c(29457) : warning C4244: 'function' : conversion from '__pyx_t_5numpy_int64_t' to 'Py_ssize_t', possible loss of data
  pandas\src\tseries.c(32203) : warning C4244: 'function' : conversion from '__pyx_t_5numpy_int64_t' to 'Py_ssize_t', possible loss of data

any help appreciated! I previously had no trouble building this. I have the latest cython and numpy releases.

Thanks!

@wesm
Copy link
Member

wesm commented Dec 7, 2011

@m-paradox do you know the answer here? the offending C code is

inline int
assign_value_1d(PyArrayObject* ap, Py_ssize_t _i, PyObject* v) {
  char *item;
  npy_intp i = (npy_intp) _i;
  item = PyArray_DATA(ap) + i * PyArray_STRIDE(ap, 0);
  return PyArray_DESCR(ap)->f->setitem(v, item, ap);
}

@wesm
Copy link
Member

wesm commented Dec 7, 2011

hi Sam I made the above changes. Can you verify that your build works and I'll close the issue?

@mwiebe
Copy link
Contributor

mwiebe commented Dec 7, 2011

PyArray_DATA(ap) returning void * is the problem, as it looks like you solved in your patch. There's also PyArray_BYTES which returns a char * instead of void *:

http://docs.scipy.org/doc/numpy/reference/c-api.array.html#PyArray_DATA

@wesm
Copy link
Member

wesm commented Dec 7, 2011

I got the MSVC compiler set up in my VM and verified that all's OK now. Tons of compiler warnings (Py_ssize_t -> int32_t casts) that I need to fix

@wesm wesm closed this as completed Dec 7, 2011
@reckoner
Copy link
Author

reckoner commented Dec 8, 2011

The fix works! Thanks!

@m-paradox: How did you find this? The compiler message complained about a void pointer in the numpy_helper.h file that did not have any 'void''s in it.

@mwiebe
Copy link
Contributor

mwiebe commented Dec 8, 2011

Wes found and fixed the issue, I was just showing that the original designers of the API had intended that PyArray_DATA be used when casting to a specific pointer (like double *), and PyArray_BYTES be used when processing generically (in this case). A 'void' doesn't have a size, so adding the stride-based offset to a 'void *' isn't defined.

I would prefer to change PyArray_DATA to also return char *, because the void * use case allows implicit conversion and is an easy source of errors.

@wesm
Copy link
Member

wesm commented Dec 8, 2011

Mark, I copy-pasted part of that method from multiarray/mappings.c in the NumPy codebase-- does that also need a cast to char * to work with MSVC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms
Projects
None yet
Development

No branches or pull requests

3 participants