Sudden linking error on macOS on same version that used to build (8.2.0)

I’m trying to fix the Macports package of vtk that ships 8.2.0 version and that needs the fix for tp_print with python 3.8.

The problem is that this version used to build successfully without Python (I did not change the configuration flags provided by the Macports), but now I’m hitting a strange linking error that I’m unable to fix (this is a rerun with make not in parallel). It looks like a strange problem with my system, apparently…

Cmake flags:

/opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" 
-DCMAKE_BUILD_TYPE=MacPorts \
-DCMAKE_INSTALL_PREFIX="/opt/local" \
-DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" \
-DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" \
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW \
-DCMAKE_POLICY_DEFAULT_CMP0060=NEW \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_COLOR_MAKEFILE=ON \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_MAKE_PROGRAM=/usr/bin/make \
-DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" \
-DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_INSTALL_RPATH="/opt/local/lib" \
-Wno-dev \
../VTK-8.2.0/ \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_EXAMPLES:BOOL=OFF \
-DVTK_WRAP_JAVA:BOOL=OFF \
-DVTK_USE_SYSTEM_LIBRARIES:BOOL=ON \
-DVTK_USE_SYSTEM_LIBPROJ:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=ON \
-DVTK_Group_MPI:BOOL=ON \
-DModule_vtkIOFFMPEG:BOOL=ON \
-DVTK_WRAP_PYTHON:BOOL=ON \
-DPYTHON_EXECUTABLE:STRING=/opt/local/bin/python3.8 \
-DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/3.8/Headers/ \
-DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib \
-DVTK_INSTALL_PYTHON_MODULES_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages \
-DVTK_USE_SYSTEM_MPI4PY:BOOL=ON \
-DVTK_USE_SYSTEM_XDMF2:BOOL=OFF \
-DNETCDF_DIR=/opt/local \
-DBOOST_ROOT=/opt/local \
-DModule_vtkIOXdmf2:BOOL=ON \
-DModule_vtkxdmf2:BOOL=ON \
-DModule_vtkxdmf3:BOOL=ON \
-DModule_vtkIOXdmf3:BOOL=ON \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" \
-DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" \
/opt/local/var/macports/build/_Users_rubendibattista_git_macports-ports_graphics_vtk/vtk/work/VTK-8.2.0
:info:build [  1%] Linking CXX shared library ../../lib/libvtkCommonMath-8.2.dylib
:info:build cd /opt/local/var/macports/build/_Users_rubendibattista_git_macports-ports_graphics_vtk/vtk/work/build/Common/Math && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/vtkCommonMath.dir/link.txt --verbose=ON
:info:build /opt/local/bin/mpicxx-mpich-mp -pipe -Os -DNDEBUG -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.15 -dynamiclib -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk  -compatibility_version 1.0.0 -current_version 1.0.0 -o ../../lib/libvtkCommonMath-8.2.1.dylib -install_name @rpath/libvtkCommonMath-8.2.1.dylib CMakeFiles/vtkCommonMath.dir/vtkAmoebaMinimizer.cxx.o CMakeFiles/vtkCommonMath.dir/vtkFunctionSet.cxx.o CMakeFiles/vtkCommonMath.dir/vtkInitialValueProblemSolver.cxx.o CMakeFiles/vtkCommonMath.dir/vtkMatrix3x3.cxx.o CMakeFiles/vtkCommonMath.dir/vtkMatrix4x4.cxx.o CMakeFiles/vtkCommonMath.dir/vtkPolynomialSolversUnivariate.cxx.o CMakeFiles/vtkCommonMath.dir/vtkQuaternionInterpolator.cxx.o CMakeFiles/vtkCommonMath.dir/vtkRungeKutta2.cxx.o CMakeFiles/vtkCommonMath.dir/vtkRungeKutta4.cxx.o CMakeFiles/vtkCommonMath.dir/vtkRungeKutta45.cxx.o  -Wl,-rpath,/opt/local/lib ../../lib/libvtkCommonCore-8.2.1.dylib
:info:build ld: file not found: /opt/local/lib/libvtksys-8.2.1.dylib for architecture x86_64

And this is the full log.

I found the problem. As often happens the Duck Debugging Method works amazingly. The issue was that this cmake argument was not removed as expected by Macports.