Error in Building riscv-openocd


I am trying to build riscv-openocd (which is the debugger) from the repository . I got below error.

/opt/riscv-tools/riscv-tools/riscv-openocd/build/jimtcl/…/…/jimtcl/jim-aio.c:2070: undefined reference to `openpty’
collect2: error: ld returned 1 exit status
Makefile:2760: recipe for target ‘src/openocd’ failed
make[2]: *** [src/openocd] Error 1
make[2]: Leaving directory ‘/opt/riscv-tools/riscv-tools/riscv-openocd/build’
Makefile:4092: recipe for target ‘all-recursive’ failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory ‘/opt/riscv-tools/riscv-tools/riscv-openocd/build’
Makefile:1748: recipe for target ‘all’ failed
make: *** [all] Error 2

where is this openpty API located ? in which library?

What version of riscv-tools and riscv-openocd do you have? I see no openpty calls in jimtcl, and the jimtcl/jim-aio.c file has only 1509 lines but you got an error on line 2070.

On a linux/glibc system, openpty is in libutil. But openpty is a function from BSD which is not POSIX so it is odd for code to be using it, unless maybe it was configured for BSD. If you aren’t on a BSD system, then maybe there is a configure problem.