@krrishabh
The error you got is due to .so missing in my opinion.
Can you make a change here and try?
Put target_link_libraries under find_package, add linking library in target_link_libraries only, like this:
find_package(Torch REQUIRED PATHS /home/rakesh/rishabh_workspace/Garbage/kaldi/tools/libtorch)
target_link_libraries(kaldi-pyrnnlm PUBLIC
kaldi-lm
kaldi-util
kaldi-matrix
kaldi-base
${TORCH_LIBRARIES}
)
And then add -lz, -ldl, -fPIC to target_compile_options, they are not linking libraries.