Trying to compile NodeMCU (LUA) with math support
Posted: Mon Feb 16, 2015 7:02 am
The math package within NodeMCU is pretty incomplete, so i resorted to build withing the pwm.c module located in app/modules the three mathematical functions i'm gonna need: just atan, sqrt and pow.
Inside pwm.c i got this:
int lpwm_sqrt( lua_State* L )
{
lua_pushnumber( L, sqrt(64) );
return 1;
}
Now, i can compile it and make it print a value if i statically call the function pwm.sqrt() from the Node console. But, if I change the argument of the sqrt() to a variable, the compiler tells me «(...) undefined reference to `sqrt' (...)».
Including math.h won't help and adding -lm to the linker options won't either.
Has anyone experienced a similar situation?
Inside pwm.c i got this:
int lpwm_sqrt( lua_State* L )
{
lua_pushnumber( L, sqrt(64) );
return 1;
}
Now, i can compile it and make it print a value if i statically call the function pwm.sqrt() from the Node console. But, if I change the argument of the sqrt() to a variable, the compiler tells me «(...) undefined reference to `sqrt' (...)».
Including math.h won't help and adding -lm to the linker options won't either.
Has anyone experienced a similar situation?