Based on the log it seems the build is failing in:
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
COMPILER_WORKS_EXITCODE (advanced)
COMPILER_WORKS_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see /home/perform/package-create/kush/sources/fu540-build/tmp-glibc/work/riscv64-oe-linux/pytorch

which points towards cross-compiling for a RISCV platform so you might need to set these cmake variables.
PS: you can post code snippets and logs by wrapping them into three backticks ```, which would make debugging easier.