brimworks / lua-ev

Lua integration with libev.
MIT License
225 stars 55 forks source link

Help with build and dependencies #17

Closed aniruddha-a closed 8 years ago

aniruddha-a commented 10 years ago

Hello,

I am not conversant with CMake, also if I have to include this project into the build system that we already have, then I have to write a waf script (wscript) for lua-ev. May I request to please add a simple Unix Makefile, or give me the dependency and build steps, so that I can integrate into our build system.

Thanks.

aniruddha-a commented 10 years ago

ok, had to dig a little more, its all in a single file. so this should suffice:

gcc -I /path/to/lua/include  -lev  -shared -o ev.so -fPIC lua_ev.c

But, I still get this error when I try to load! :(

undefined symbol: ev_default_loop_ptr
aniruddha-a commented 10 years ago

Hello, Can anyone please help me with the undefined symbol error ... Do I have to rebuild libev4 from source on my machine (Ubuntu 12.04 LTS), or is it something else that I am missing? I saw some mail threads on the Node.js mailers where people where facing this same issue, but got rid of it with an upgrade, but I'm not sure how I should deal with this in the context of lua-ev. Thanks

brimworks commented 10 years ago

Can you give the complete error message? Typically this simply means you didn't add the right linker flag(s). If the symbol is something that is part of lua, then you can either link against the dynamic lua library or pass the flag to the linker that says "ignore these undefined symbols" (the exact flag depends on the linker). The only reason these could be ignored is if Lua is dynamically linking with lua-ev, then the lua symbols will already be defined in the interpreter and therefore these undefined symbols are of no consequence.

Cheers, -Brian

aniruddha-a commented 10 years ago

Hi Brian,

This is what I have:

$ readlink  /usr/lib/libev.so
libev.so.4.0.0

and I built lua-ev in one step - like I mentioned above (and I get ./ev.so).

Then, in lua-ev directory, I try to run the example.lua file:

$ lua example.lua 
lua: error loading module 'ev' from file './ev.so':
    ./ev.so: undefined symbol: ev_default_loop_ptr
stack traceback:
    [C]: ?
    [C]: in function 'require'
    example.lua:82: in main chunk
    [C]: ?

I am using lua-5.1.5 (build from source on my Ubuntu 12.04 LTS)