AcademySoftwareFoundation / AcademySoftwareFoundation/Imath
Can't build PyImath_d on Windows without debug Python build
- Dominant language
- C++
- Stars
- 488
- Forks
- 161
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 3
Description
On Windows pyconfig.h automatically links to debug Python builds if _DEBUG is defined:
https://github.com/python/cpython/blob/v3.10.9/PC/pyconfig.h#L270-L271
Boost Python wraps this so that it can be compiled in debug mode without requiring a debug build of Python:
https://github.com/boostorg/python/blob/boost-1.76.0/include/boost/python/detail/wrap_python.hpp#L23-L48
This is the default behaviour and can be controlled using BOOST_DEBUG_PYTHON.
Because PyImath headers include Python.h directly this bypasses the Boost python wrapper causing link incompatibility.
These headers should include `boost/python/detail/wrap_python.hpp` instead. Other libraries (e.g. USD) wrap BOOST_DEBUG_PYTHON in a cmake option, e.g.: https://github.com/PixarAnimationStudios/USD/pull/1478
Contributor guide
Research direction
Start by locating the PyImath headers that include Python.h and compare their includes with Boost.Python's wrap_python.hpp. Replace the direct Python header usage as described, then verify that PyImath builds and links on Windows without requiring a debug Python build.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, python
- Domain
- build-system, computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100