Building Shapeworks from Source

I would like to make some contributions to Shapeworks but am having trouble setting up a developer environment. I am running Windows 11 and trying to follow the instructions here. Here are the steps I have taken:

  • CMake, Visual Studio, and Anaconda are already installed. I forked the Shapeworks repository and cloned it to my PC.

  • With conda activated in Powershell, run install_shapeworks.bat. Then run conda activate shapeworks

  • In git bash, run ./build_dependencies. This resulted in an error: Could not find boost. I gather this is because install_shapeworks.bat does not install the developer dependencies.

  • So, in git bash, I activated conda, then ran source install_shapeworks.sh

  • Ran ./build_dependencies. Seemed to run fine this time. Took about 1 hour. The end of my build_dependencies.log looks like this:

Dependency paths:
  VTK_DIR: /c/g/shapeworks_dev/dependencies/install/lib/cmake/vtk-9.1
  ITK_DIR: /c/g/shapeworks_dev/dependencies/install/lib/cmake/ITK-5.2
  EIGEN_DIR: 
  OpenVDB_DIR: /c/g/shapeworks_dev/dependencies/install/lib/cmake/OpenVDB/
  LIBIGL_DIR: /c/g/shapeworks_dev/dependencies/install/libigl/cmake
  GEOMETRY_CENTRAL_DIR: /c/g/shapeworks_dev/dependencies/install/geometry-central
  ACVD_DIR: /c/g/shapeworks_dev/dependencies/install


## To configure ShapeWorks, create a build directory and from there run...

cmake -DCMAKE_CXX_FLAGS= -DCMAKE_PREFIX_PATH=/c/g/shapeworks_dev/dependencies/install -DUSE_OPENMP=ON  -Wno-dev -Wno-deprecated -DCMAKE_BUILD_TYPE=Release /c/g/shapeworks_dev

real	60m24.389s
user	0m0.060s
sys	0m0.289s

  • Installed version 6.6.1 of open source QT. Added C:\Qt\6.6.1\msvc2019_64\bin to my Path environment variable.

  • Created a directory named build, then entered it and ran the exact cmake command from the build_dependencies output.

  • Ran start shapeworks.sln. In visual studio, set configuration to release. Build ran with 32 succeeded, 0 failed, 2 skipped.

  • Back in git bash, ran cmake -P cmake_install.cmake (Not sure if this is needed?) Redulted in error, cannot find C:\Windows\SysWOW64\vcruntime140_1.dll. Pasted this dll into this location from the ITK installation in conda. cmake script then ran fine.

  • Ran source …/devenv.sh ./bin/Release/

  • Ran ctest -C Release. Resulted in 40% pass:

Test project C:/g/shapeworks_dev/build
      Start  1: ImageTests
 1/10 Test  #1: ImageTests .......................   Passed   61.40 sec
      Start  2: MeshTests
 2/10 Test  #2: MeshTests ........................   Passed   25.21 sec
      Start  3: GroomTests
 3/10 Test  #3: GroomTests .......................Exit code 0xc0000135
***Exception:   0.03 sec
      Start  4: OptimizeTests
 4/10 Test  #4: OptimizeTests ....................Exit code 0xc0000135
***Exception:   0.03 sec
      Start  5: PythonTests
 5/10 Test  #5: PythonTests ......................***Failed   41.59 sec
      Start  6: ParticlesTests
 6/10 Test  #6: ParticlesTests ...................   Passed    6.10 sec
      Start  7: ProjectTests
 7/10 Test  #7: ProjectTests .....................Exit code 0xc0000135
***Exception:   0.03 sec
      Start  8: UseCaseTests
 8/10 Test  #8: UseCaseTests .....................***Failed   13.29 sec
      Start  9: shapeworksTests
 9/10 Test  #9: shapeworksTests ..................***Failed    6.65 sec
      Start 10: UtilsTests
10/10 Test #10: UtilsTests .......................   Passed    0.04 sec

40% tests passed, 6 tests failed out of 10

Total Test time (real) = 154.41 sec
  • Importing shapeworks in python results in the following error:
Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:50:36) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import shapeworks
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\g\shapeworks_dev\Python\shapeworks\shapeworks\__init__.py", line 5, in <module>
    from shapeworks_py import *
ImportError: DLL load failed while importing shapeworks_py: The specified module could not be found.

I am surprised it build with Qt6 with no changes, but that’s great.

All of your test errors are likely related to the python module loading. It’s a little more difficult on windows. You may need to add the shapeworks bin directory to both %PATH% and %PYTHONPATH%.