stetre / moonlibs

Lua libraries for graphics and audio programming
219 stars 11 forks source link

Most all libs fail to build #10

Closed Its-Kenta closed 1 year ago

Its-Kenta commented 1 year ago

Hi, I've been trying to build the libs on Arch, I have all depends but I'm getting errors building, and it happens to pretty much every single library. I will have to attach the errors really because they're just too big.

Chipmunk OpenGL GLFW GLMath

I thought I would post this issue here as every single lib fails to build for me and I have absolutely no idea why because libs that use opengl and glfw simply build and run perfectly fine (Raylib as an example).

Thanks!

stetre commented 1 year ago

Hi, let's tackle one problem at a time. The first strange thing I noticed is this:

/usr/local/include/lua.h: In function ‘lua_istrue’:
/usr/local/include/lua.h:184:62: error: expected declaration specifiers before ‘noexcept’
  184 | LUA_API int             (lua_istrue) (lua_State *L, int idx) noexcept;

As far as I know, there is no lua_istrue function in lua.h, so the question is: where does that header file come from? Is it from an old version of Lua, or from a custom one?

Its-Kenta commented 1 year ago

Hi, let's tackle one problem at a time. The first strange thing I noticed is this:

/usr/local/include/lua.h: In function ‘lua_istrue’:
/usr/local/include/lua.h:184:62: error: expected declaration specifiers before ‘noexcept’
  184 | LUA_API int             (lua_istrue) (lua_State *L, int idx) noexcept;

As far as I know, there is no lua_istrue function in lua.h, so the question is: where does that header file come from? Is it from an old version of Lua, or from a custom one?

Okay that made me find the cause for this issue which was caused by a subset of Lua called Pluto. It does not overwrite lua.h from Lua 5.4, but creates a new one in usr/local/include but make decides to take that one over the /usr/include/ (which is Lua 5.4 one) Is there a way to define that in makefile?

stetre commented 1 year ago

In the Makefile there is a INCDIR variable where you can specify any additional include path to be passed to the compiler with the -I option. The paths passed this way should take precedence over the standard paths, so in principle if you add -I/usr/include to INCDIR this should solve the problem. Except... it doesn't seem to. Moonglmath, for example, already has this path specified in INCDIR, but from your logs it turns out that the compiler still includes from /usr/local/include. Are you really sure the headers from Lua 5.4 are in /usr/include ?

(By the way, let me say that it's not a great idea to put a non-standard header file in the very first standard location where the compiler searches for header files...)

Its-Kenta commented 1 year ago

In the Makefile there is a INCDIR variable where you can specify any additional include path to be passed to the compiler with the -I option. The paths passed this way should take precedence over the standard paths, so in principle if you add -I/usr/include to INCDIR this should solve the problem. Except... it doesn't seem to. Moonglmath, for example, already has this path specified in INCDIR, but from your logs it turns out that the compiler still includes from /usr/local/include. Are you really sure the headers from Lua 5.4 are in /usr/include ?

(By the way, let me say that it's not a great idea to put a non-standard header file in the very first standard location where the compiler searches for header files...)

Can confirm the headers from Lua 5.4 are in /usr/include but it defaults to Pluto's own. I have no reason to disagree with you, while Pluto runs its code on .lua it also runs standard lua that way, but I'm pretty sure that could've been done in a better way to avoid this from happening.

My issue is now closed really, thank you! If it wasn't for you pointing it I would've just given up on it.