Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
385 stars 73 forks source link

Undefined symbol #30

Closed kraxarn closed 3 years ago

kraxarn commented 9 years ago

I get the following error when trying to require the .so file from a lua project:

"error loading module 'SDL' from file '/usr/local/lib/lua/5.1/SDL.so'" : 0 : undefined symbol

Tangent128 commented 9 years ago

Hi; would you mind providing some extra information to see if I can help?

Tangent128 commented 9 years ago

My best guess would be that you are using Lua 5.1, while the build system defaults to building a Lua 5.2 version of the module.

If you think that's the case, you can change the targeted Lua version; see Customizing The Build

kraxarn commented 9 years ago

Lua is installed to /usr/local/lib/lua/5.1/, but I also tried running it from the directory of the program. I'm running Ubuntu 15.04 x64 The require line is the same as in the example: local SDL = require 'SDL' And how do I check that package.path and cpath?

Tangent128 commented 9 years ago

To check the paths, run this from Lua, either as a script or interactively:

print(package.path)
print(package.cpath)

It looks like you compiled Lua yourself, so I'm assuming you compiled the SDL module as well; did you set the Lua version to 5.1 when you did so?

kraxarn commented 9 years ago

Sorry, I meant this, luasdl, installed it with make install Lua is not compiled by me, it's installed from the official Ubuntu stuff

package.path: ./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua

package.cpath: ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so

Tangent128 commented 9 years ago

Huh, Ubuntu installs Lua under /usr/local by default? But anyways, it seems like the module's being found, at least.

So, I assume you ran cmake at some point before running make install. Did you pass any flags to it?

If not, try passing -DWITH_LUAVER=51 at the cmake step, and rebuild.

kraxarn commented 9 years ago

Nah, it's installed to /usr/bin/lua5.1 And yea, I passed that flag to it, since I'm using Lua 5.1, haven't tried any other flag or no flag

Tangent128 commented 9 years ago

Sorry for delay, was on vacation. I... am kinda baffled, unfortunately.

Would you be willing to try installing it through Luarocks? There should be an Ubuntu package.

markand commented 3 years ago

I've changed the way the bindings links to Lua (it shouldn't link to it) any issue should be fixed now (tested on mac and Linux).