Building Static Libraries Fail

The project I’m building requires that libtorch be built statically. I am following the instructions in the docs directory, but it fails at the end of the build. Specifically, when linking libshm. I get the following error

Linking CXX shared library …/…/…/…/lib/libshm.so
clang: error: no such file or directory: ‘$<TARGET_FILE:dnnl_graph>’

Whats curious to me is that it is build libshm.so instead of libshm.a. I have the environment variable BUILD_SHARED_LIBS set to OFF, so I’m not sure why this is the case. Any suggestions? I’m not sure what dnnl_graph is and why it is not there

Were you able to solve this problem?

If yes, then can you share a fix?

I didn’t face the libshm.so linking error with Pytorch v1.9.1.

However, I faced a different error which I was able to solve with -DBUILD_PYTHON:BOOL=OFF as explained here: Errors when building static linked LibTorch