Esp8266 Undefined reference to '_unlink_r' (also to '_getpid_r')

hi... i am trying to embed Lua language in a esp8266 application, based on this = GitHub - sfranzyshen/ESP-Arduino-Lua: Lua scripting engine integrated in Arduino IDE as a Library for ESP8266/ESP32

for that i developed a library header that is simply a lua wrapper

#include "lua/lua.hpp"

with folder <libraries>/LuaWrapper/lua/ having the lua source code (v5.4.7 at this time), i also made some adjusts to make Lua able to print()

so, my sketch at some point have code like

lua_State* L = luaL_newstate();
luaopen_base(L);
luaopen_table(L);
luaopen_string(L);
//luaopen_io(L);

and everything after seem to work fine: luaL_loadstring(), lua_pcall(), etc

you have noticed that i had commented a line in the code... when i uncomment just THAT single line and try to compile again it fails with the message:

c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-remove.o):(.literal+0x0): undefined reference to `_unlink_r'
c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-remove.o): in function `_remove_r':
/workdir/repo/newlib/newlib/libc/stdio/remove.c:65: undefined reference to `_unlink_r'
c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-tmpnam.o):(.literal+0x14): undefined reference to `_getpid_r'
c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-tmpnam.o): in function `_tmpnam_r':
/workdir/repo/newlib/newlib/libc/stdio/tmpnam.c:129: undefined reference to `_getpid_r'
c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: c:/users/atesin/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.1.0-gcc10.3-e5f9fec/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/lib\libc.a(lib_a-tmpnam.o): in function `_tempnam_r':
/workdir/repo/newlib/newlib/libc/stdio/tmpnam.c:161: undefined reference to `_getpid_r'
collect2.exe: error: ld returned 1 exit status

is important for me to add luaopen_io() to my sketch because i want my Lua app to support files in the future (LittleFS, SD or whatever)

i noticed that macros/functions are present in esp8266 source files but for some reason they are not compiling