Build failure when building thirdparty mpi4py
Hi guys, Recently I'm trying to build vtk with internal module mpi4py (https://github.com/microsoft/vcpkg/pull/24740), but I got some failures:
FAILED: ThirdParty/mpi4py/vtkmpi4py/src/CMakeFiles/vtkmpi4py.MPI.dir/MPI.c.obj
C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1432~1.313\bin\Hostx64\x64\cl.exe -DMPICH_SKIP_MPICXX -DMPI_NO_CPPBIND -DOMPI_SKIP_MPICXX -DPyMPI_MISSING_MPI_Status_c2f -DPyMPI_MISSING_MPI_Status_f2c -DPyMPI_MISSING_MPI_Type_create_f90_complex -DPyMPI_MISSING_MPI_Type_create_f90_integer -DPyMPI_MISSING_MPI_Type_create_f90_real -DVTK_IN_VTK -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_MPICC_H -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -Dvtkmpi4py_MPI_EXPORTS -ID:\buildtrees\vtk\x64-windows-dbg\Utilities\Python -ID:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\Utilities\Python -ID:\buildtrees\vtk\x64-windows-dbg\Common\Core -ID:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\Common\Core -external:ID:\buildtrees\vtk\x64-windows-dbg\Utilities\MPI -external:ID:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\Utilities\MPI -external:ID:\installed\x64-windows\include -external:ID:\buildtrees\vtk\x64-windows-dbg\Utilities\KWIML -external:ID:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\Utilities\KWIML -external:ID:\buildtrees\vtk\x64-windows-dbg\Utilities\KWSys -external:ID:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\Utilities\KWSys -external:ID:\installed\x64-windows\include\python3.10 -external:W0 /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP /bigobj /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 -MDd /showIncludes /FoThirdParty\mpi4py\vtkmpi4py\src\CMakeFiles\vtkmpi4py.MPI.dir\MPI.c.obj /FdThirdParty\mpi4py\vtkmpi4py\src\CMakeFiles\vtkmpi4py.MPI.dir\ /FS -c D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\MPI.c
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(154210): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(154212): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(154500): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(154502): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(154880): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(154882): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155076): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155078): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155263): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155265): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155459): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155461): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155678): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155680): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155848): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(155850): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(156863): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(156865): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(157169): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(157171): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(157439): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(157441): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(157612): error C2105: '++' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(157614): error C2105: '--' needs l-value
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(174420): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
D:\buildtrees\vtk\src\edd2e5233f-2ed574e023.clean\ThirdParty\mpi4py\vtkmpi4py\src\mpi4py.MPI.c(174436): warning C4996: '_PyUnicode_get_wstr_length': deprecated in 3.3
Then I searched the same issue by google, and I found the workaround is:
diff --git a/ThirdParty/mpi4py/vtkmpi4py/src/mpi4py.MPI.c b/ThirdParty/mpi4py/vtkmpi4py/src/mpi4py.MPI.c
index d01c266..9983ac9 100644
--- a/ThirdParty/mpi4py/vtkmpi4py/src/mpi4py.MPI.c
+++ b/ThirdParty/mpi4py/vtkmpi4py/src/mpi4py.MPI.c
@@ -154207,9 +154207,9 @@ static void __pyx_tp_dealloc_6mpi4py_3MPI_Datatype(PyObject *o) {
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
+ Py_SET_REFCNT(o, Py_REFCNT(o) + 1);
__pyx_pw_6mpi4py_3MPI_8Datatype_3__dealloc__(o);
- --Py_REFCNT(o);
+ Py_SET_REFCNT(o, Py_REFCNT(o) - 1);
PyErr_Restore(etype, eval, etb);
}
(*Py_TYPE(o)->tp_free)(o);
It seems that the problem is caused by the wrong version of cpython (or python? maybe). And I found the mpi4py was updated to 3.1.3 now: https://github.com/mpi4py/mpi4py/tree/master.
Any ideas on this issue?
Thanks, Jack
Edited by Jack·Boos·Yu