Hi,
It does look weird indeed.
It looks like it splits the compilation command line in the middle and so the compiler does not have input files specified, and it tries to execute the compiler arguments as bash methods.

Do you by any change used a windows computer to get the code before putting it on the machine where you compile?
Will you need the distributed package? If not, try compiling with NO_DISTRIBUTED=1 as MPI might be the problem here.
If that does not help, could you run make in verbose mode directly within /macierz/home/155079jp/Programs/pytorch/torch/lib/build/THD to see what is the exact command that it tries to execute please? That would help us fix this problem.