Undefined reference to 'system'

I’m having a linker problem and getting the error: undefined reference to 'system'

C:\Users\Jez.platformio\packages\framework-arduinoespressif32\cores\esp32/WString.h:48: undefined reference to system' .pio\build\nodemcu-32s\lib447\liblua.a(loslib.c.o): In function os_execute’:
C:\Users\Jez\Documents\PlatformIO\Projects\FullLua/lib\lua/loslib.c:145: undefined reference to `system’

system() is being called from lua which I’m compiling from the lib/ directory.

I’ve tried using these build flags in platformio.ini:
build_flags = -lstdc++ -lsupc++ -lm

My setup:

platform = espressif32
board = nodemcu-32s
framework = arduino

Should I just precompile lua into a static library? Or is there a way to build my project as is?

I’m probably missing something obvious, but anyone could lend me a hand here, I’d really appreciate it!

Calling system() in an Arduino / embedded environment makes no sense – you don’t have a shell to execute commands in. The API doesn’t exist. That’s also why this repo has commented out the function content entirely. When I look at other repos like ESP-Arduino-Lua, it doesn’t even have the os_execute function.

Are you sure you don’t want to use the library above?

@maxgerhardt thanks for the reply!

Makes sense, I was commenting it out of my lua library too, and everything built ok, but I couldn’t get require() to run, and therefore I couldn’t reference other lua files which I’m guessing it’s a FS issue, but thought I might also need os_execute.

stdlib.h in the platformio sdk has it declared, so I thought I might be able to get away with it! :

int _EXFUN(system,(const char *__string));