Thanks for debugging further. I think the answer to the previous problem is that we should use cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch .. instead of cmake -DCMAKE_PREFIX_PATH=relative/path/to/libtorch ... Putting it here so that other users could see the solution.