I’ve tested the static build and it should be fixed. (However, there is currently a bug in torch/CMakeLists.txt#L268-269. It could be solved by swapping the two lines. PR https://github.com/pytorch/pytorch/pull/15989 14 is on this.) The step is simply setting set EXTRA_CAFFE2_CMAKE_FLAGS= -DTORCH_STATIC=1 before build.