Skip to content
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

[BUILD] Python module failure to build on MSVC 2022 with numpy: ssize_t: undeclared identifier #1727

Open
Luke-Skycrawler opened this issue Dec 7, 2023 · 2 comments · May be fixed by #1706

Comments

@Luke-Skycrawler
Copy link

Luke-Skycrawler commented Dec 7, 2023

Environment

Operating System: Windows 11
Version / Commit SHA: 11.0.0
CMake Version: 3.21
Compiler: msvc 2022

Describe the problem

When I build the python module with numpy support, the MSVC compiler will complain about the ssize_t used in pyGrid.h

To Reproduce

Steps to reproduce the behavior:

  1. Use the 11.0.0 Release
  2. install all the dependencies using vcpkg, basically following README.md. Toggle on OPENVDB_BUILD_WITH_PYTHON_MODULE and USE_NUMPY. (I did it in CMake GUI)
  3. See error
cmake --build . --parallel 4 --config Release --target install
MSBuild version 17.7.2+d6990bcfa for .NET Framework

  openvdb_shared.vcxproj -> C:\repo\openvdb-11.0.0\openvdb-11.0.0\build\openvdb\openvdb\Release\openvdb.dll
  pyFloatGrid.cc
  pyGridBase.cc
  pyIntGrid.cc
  pyMetadata.cc
  pyOpenVDBModule.cc
  pyPointGrid.cc
  pyTransform.cc
  pyVec3Grid.cc
C:\repo\openvdb-11.0.0\openvdb-11.0.0\openvdb\openvdb\python\pyGrid.h(325,33): error C2065: 'ssize_t': undeclared ident
ifier (compiling source file C:\repo\openvdb-11.0.0\openvdb-11.0.0\openvdb\openvdb\python\pyOpenVDBModule.cc) [C:\repo\
openvdb-11.0.0\openvdb-11.0.0\build\openvdb\openvdb\python\pyopenvdb.vcxproj]
C:\repo\openvdb-11.0.0\openvdb-11.0.0\openvdb\openvdb\python\pyGrid.h(325,26): error C2923: 'std::vector': 'ssize_t' is
 not a valid template type argument for parameter '_Ty' (compiling source file C:\repo\openvdb-11.0.0\openvdb-11.0.0\op
envdb\openvdb\python\pyOpenVDBModule.cc) [C:\repo\openvdb-11.0.0\openvdb-11.0.0\build\openvdb\openvdb\python\pyopenvdb.
vcxproj]

I managed to get it fixed according to here https://github.com/eridur-de/mightyscape-1.2/issues/131. The fix was to replace all ssize_t with size_t in pyGrid.h.

@Luke-Skycrawler Luke-Skycrawler changed the title [BUILD] Failure to build on MSVC 2022: ssize_t: undeclared identifier [BUILD] Python module failure to build on MSVC 2022 with numpy: ssize_t: undeclared identifier Dec 7, 2023
@nranthony
Copy link

I also have this issue, and I'm reluctant to start editing code directly due to the time and technical debt that builds up most of the time. Let me know if you need additional information from my perspective.

Isn't this just an OS flag that flips between type definitions? Or am I oversimplifying things?

I ended up going to WSL Ubuntu 22.04 and working there (tried with the Ubuntu 20.04 I had installed, but that didn't work due to versions of libraries being too low on that older OS). There's a list of things that need to be installed and setup (and half my time is focused on setting up oh-my-zsh, just because ;)) but it works in the end. Working inasmuch as I can import and generate the hello world sphere without error. Not sure on functionality from that point onwards.

@Luke-Skycrawler , let me know if you need further info on the WSL direction.

@Idclip Idclip linked a pull request Jan 5, 2024 that will close this issue
@Idclip
Copy link
Contributor

Idclip commented Jan 5, 2024

I believe the following PR may solve this issue #1706

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

Successfully merging a pull request may close this issue.

3 participants