Giter Site home page Giter Site logo

lua-ev's Issues

luarocks not install lua-ev. please teach me lua-ev install.

Sorry Please teach me How to install official .

Enviroment Scientific Linux 6.3

yum install libev libev-devel already install

I tried luarocks install ...

luarocks install lua-ev
Installing http://luarocks.org/repositories/rocks/lua-ev-v1.3-1.src.rock...
Using http://luarocks.org/repositories/rocks/lua-ev-v1.3-1.src.rock... switching to 'build' mode
Archive:  /tmp/luarocks_luarocks-rock-lua-ev-v1.3-1-9367/lua-ev-v1.3-1.src.rock
  inflating: lua-ev-v1.3-1.rockspec  
  inflating: lua-ev-v1.3.tar.gz      

Error: Could not find expected file libev.so for LIBEV -- you may have to install LIBEV in your system and/or pass LIBEV_DIR or LIBEV_LIBDIR to the luarocks command. Example: luarocks install lua-ev LIBEV_DIR=/usr/local
locate libev.so
/usr/lib64/libev.so
/usr/lib64/libev.so.4
/usr/lib64/libev.so.4.0.0

locate ev.h
/usr/include/libev/ev.h
  -
  - 
luarocks install lua-ev LIBEV_LIBDIR=/usr/lib64/ LIBEV_DIR=/usr/include/libev/ev.h 
Installing http://luarocks.org/repositories/rocks/lua-ev-v1.3-1.src.rock...
Using http://luarocks.org/repositories/rocks/lua-ev-v1.3-1.src.rock... switching to 'build' mode
Archive:  /tmp/luarocks_luarocks-rock-lua-ev-v1.3-1-1027/lua-ev-v1.3-1.src.rock
  inflating: lua-ev-v1.3-1.rockspec  
  inflating: lua-ev-v1.3.tar.gz      

Error: Could not find expected file ev.h for LIBEV -- you may have to install LIBEV in your system and/or pass LIBEV_DIR or LIBEV_INCDIR to the luarocks command. Example: luarocks install lua-ev LIBEV_DIR=/usr/local

so git clone lua-ev and cmake

cmake28 . && make
-- Could NOT find libev (missing:  LIBEV_INCLUDE_DIR) 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LIBEV_INCLUDE_DIR
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev
   used as include directory in directory /root/lua-ev

-- Configuring incomplete, errors occurred!

my change CMakeLists.txt .

--- lua-ev_org/CMakeLists.txt   2012-09-28 01:41:52.271586069 +0900
+++ lua-ev/CMakeLists.txt       2012-09-28 02:41:46.929629477 +0900
@@ -15,9 +15,14 @@
 # / configs

 # Find libev
-  FIND_LIBRARY (LIBEV_LIBRARY NAMES ev)
+  FIND_LIBRARY (LIBEV_LIBRARY NAMES ev
+    PATH_SUFFIXES libev
+    PATHS
+      /usr/lib64)
   FIND_PATH (LIBEV_INCLUDE_DIR ev.h
     PATH_SUFFIXES include/ev include
+    PATHS
+      /usr/include/libev
     ) # Find header
   INCLUDE(FindPackageHandleStandardArgs)
   FIND_PACKAGE_HANDLE_STANDARD_ARGS(libev  DEFAULT_MSG  LIBEV_LIBRARY LIBEV_INCLUDE_DIR)

try cmake complete ..

#cmake .
-- Found libev: /usr/lib64/libev.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /root/lua-ev
# make
Scanning dependencies of target cmod_ev
[100%] Building C object CMakeFiles/cmod_ev.dir/lua_ev.c.o
Linking C shared module ev.so
[100%] Built target cmod_ev

please teache me official install ...

do not pcall() the associated watcher callbacks

Hoy!

I'm not sure it is a good idea to impose a pcall() on all callbacks. The user could easily wrap their callbacks in a pcall()'ing function on their own. It would mean less "liability" for lua-ev while placing this responsibility on the user -- where it belongs, imo. Even if an error were not handled and the loop were "jumped out of" memory would still be cleaned up on the termination of the script..

Yes? :-)

Not building in Mac

I'm not a real programmer, so this might be really easy, but I'm getting a pretty basic error when trying to build on a Mac.

~/src/lua-ev[master*]% make
[100%] Building C object CMakeFiles/cmod_ev.dir/lua_ev.c.o
In file included from /Users/andrew/src/lua-ev/lua_ev.c:6:
/Users/andrew/src/lua-ev/lua_ev.h:147: error: expected declaration specifiers or ‘...’ before ‘luaL_reg’
In file included from /Users/andrew/src/lua-ev/lua_ev.c:19:
/Users/andrew/src/lua-ev/loop_lua_ev.c: In function ‘create_loop_mt’:
/Users/andrew/src/lua-ev/loop_lua_ev.c:28: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/loop_lua_ev.c:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/loop_lua_ev.c:28: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/loop_lua_ev.c:28: error: (Each undeclared identifier is reported only once
/Users/andrew/src/lua-ev/loop_lua_ev.c:28: error: for each function it appears in.)
/Users/andrew/src/lua-ev/loop_lua_ev.c:28: error: expected expression before ‘]’ token
In file included from /Users/andrew/src/lua-ev/lua_ev.c:20:
/Users/andrew/src/lua-ev/watcher_lua_ev.c: At top level:
/Users/andrew/src/lua-ev/watcher_lua_ev.c:11: error: expected declaration specifiers or ‘...’ before ‘luaL_reg’
/Users/andrew/src/lua-ev/watcher_lua_ev.c: In function ‘add_watcher_mt’:
/Users/andrew/src/lua-ev/watcher_lua_ev.c:13: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/watcher_lua_ev.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘common_methods’
/Users/andrew/src/lua-ev/watcher_lua_ev.c:13: error: ‘common_methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/watcher_lua_ev.c:13: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/watcher_lua_ev.c:32: error: ‘methods’ undeclared (first use in this function)
In file included from /Users/andrew/src/lua-ev/lua_ev.c:21:
/Users/andrew/src/lua-ev/io_lua_ev.c: In function ‘create_io_mt’:
/Users/andrew/src/lua-ev/io_lua_ev.c:25: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/io_lua_ev.c:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/io_lua_ev.c:25: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/io_lua_ev.c:25: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/io_lua_ev.c:31: error: too many arguments to function ‘add_watcher_mt’
In file included from /Users/andrew/src/lua-ev/lua_ev.c:22:
/Users/andrew/src/lua-ev/timer_lua_ev.c: In function ‘create_timer_mt’:
/Users/andrew/src/lua-ev/timer_lua_ev.c:25: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/timer_lua_ev.c:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/timer_lua_ev.c:25: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/timer_lua_ev.c:25: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/timer_lua_ev.c:32: error: too many arguments to function ‘add_watcher_mt’
In file included from /Users/andrew/src/lua-ev/lua_ev.c:23:
/Users/andrew/src/lua-ev/signal_lua_ev.c: In function ‘create_signal_mt’:
/Users/andrew/src/lua-ev/signal_lua_ev.c:25: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/signal_lua_ev.c:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/signal_lua_ev.c:25: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/signal_lua_ev.c:25: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/signal_lua_ev.c:30: error: too many arguments to function ‘add_watcher_mt’
In file included from /Users/andrew/src/lua-ev/lua_ev.c:24:
/Users/andrew/src/lua-ev/idle_lua_ev.c: In function ‘create_idle_mt’:
/Users/andrew/src/lua-ev/idle_lua_ev.c:25: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/idle_lua_ev.c:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/idle_lua_ev.c:25: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/idle_lua_ev.c:25: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/idle_lua_ev.c:30: error: too many arguments to function ‘add_watcher_mt’
In file included from /Users/andrew/src/lua-ev/lua_ev.c:25:
/Users/andrew/src/lua-ev/child_lua_ev.c: In function ‘create_child_mt’:
/Users/andrew/src/lua-ev/child_lua_ev.c:30: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/child_lua_ev.c:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/child_lua_ev.c:30: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/child_lua_ev.c:30: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/child_lua_ev.c:38: error: too many arguments to function ‘add_watcher_mt’
In file included from /Users/andrew/src/lua-ev/lua_ev.c:26:
/Users/andrew/src/lua-ev/stat_lua_ev.c: In function ‘create_stat_mt’:
/Users/andrew/src/lua-ev/stat_lua_ev.c:25: error: nested functions are disabled, use -fnested-functions to re-enable
/Users/andrew/src/lua-ev/stat_lua_ev.c:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘methods’
/Users/andrew/src/lua-ev/stat_lua_ev.c:25: error: ‘methods’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/stat_lua_ev.c:25: error: expected expression before ‘]’ token
/Users/andrew/src/lua-ev/stat_lua_ev.c:31: error: too many arguments to function ‘add_watcher_mt’
/Users/andrew/src/lua-ev/lua_ev.c: At top level:
/Users/andrew/src/lua-ev/lua_ev.c:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘R’
/Users/andrew/src/lua-ev/lua_ev.c: In function ‘save_traceback’:
/Users/andrew/src/lua-ev/lua_ev.c:43: error: ‘LUA_GLOBALSINDEX’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/lua_ev.c: In function ‘luaopen_ev’:
/Users/andrew/src/lua-ev/lua_ev.c:68: error: ‘R’ undeclared (first use in this function)
/Users/andrew/src/lua-ev/lua_ev.c: In function ‘traceback’:
/Users/andrew/src/lua-ev/lua_ev.c:149: error: ‘LUA_GLOBALSINDEX’ undeclared (first use in this function)
make[2]: *** [CMakeFiles/cmod_ev.dir/lua_ev.c.o] Error 1
make[1]: *** [CMakeFiles/cmod_ev.dir/all] Error 2
make: *** [all] Error 2

I have done a bunch of (probably wrong-headed and irrelevant) things to get around it, but I'm lost. It seems like it isn't valid C code. Enabling in-line functions did nothing for me. Using gcc-4.2 did nothing.

Any help would be appreciated. Thanks!

Help with build and dependencies

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.

Install issues on OSX 10.13.3

$ CC=clang CXX=clang++ sudo -H luarocks install lua-ev
Installing https://luarocks.org/lua-ev-v1.4-1.rockspec
Cloning into 'lua-ev'...
remote: Counting objects: 35, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 35 (delta 5), reused 18 (delta 0), pack-reused 0
Receiving objects: 100% (35/35), 30.13 KiB | 186.00 KiB/s, done.
Resolving deltas: 100% (5/5), done.
Note: checking out '458165bdfe0c6eadc788813925f11a0e6a823845'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -O2 -fPIC -I/opt/local/include -c lua_ev.c -o lua_ev.o
In file included from lua_ev.c:13:
./watcher_lua_ev.c:222:39: warning: implicit declaration of function 'luaL_checkint' is invalid in C99 [-Wimplicit-function-declaration]
    if ( has_pri ) ev_set_priority(w, luaL_checkint(L, 2));
                                      ^
In file included from lua_ev.c:19:
./stat_lua_ev.c:50:28: warning: implicit declaration of function 'luaL_optint' is invalid in C99 [-Wimplicit-function-declaration]
    ev_tstamp   interval = luaL_optint(L, 3, 0);
                           ^
2 warnings generated.
env MACOSX_DEPLOYMENT_TARGET=10.8 /usr/bin/clang -bundle -undefined dynamic_lookup -all_load -o ev.so -L/opt/local/lib lua_ev.o -lev
lua-ev v1.4-1 is now installed in /opt/local/share/luarocks (license: MIT/X11)

Windows VS2010 build

Trying to compile with VS2010:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Build started 10/23/2011 5:11:24 PM.
1>InitializeBuildStatus:
1> Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>CustomBuild:
1> Checking Build System
1> CMake does not need to re-run because U:/Programming/lua-ev/CMakeFiles/generate.stamp is up-to-date.
1>FinalizeBuildStatus:
1> Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild".
1> Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.59
2>------ Build started: Project: cmod_ev, Configuration: Debug x64 ------
2>Build started 10/23/2011 5:11:24 PM.
2>InitializeBuildStatus:
2> Creating "cmod_ev.dir\Debug\cmod_ev.unsuccessfulbuild" because "AlwaysCreate" was specified.
2>CustomBuild:
2> Building Custom Rule U:/Programming/lua-ev/CMakeLists.txt
2> CMake does not need to re-run because U:\Programming\lua-ev\CMakeFiles\generate.stamp is up-to-date.
2>ClCompile:
2> lua_ev.c
2>u:\programming\lua-ev\loop_lua_ev.c(97): warning C4244: 'initializing' : conversion from 'lua_Integer' to 'unsigned int', possible loss of data
2>u:\programming\lua-ev\child_lua_ev.c(1): fatal error C1083: Cannot open include file: 'sys/wait.h': No such file or directory
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:01.12
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Build lua-ev on Windows

Hello! Could someone explain me how to build lua-ev on windows?
I have tried to build libev manually but it failed. I have tried to find compliled library on the internet but it failed again.

luarocks config.lua

rocks_trees = {
    { name = [[user]],
         root    = home..[[/luarocks]],
    },
    { name = [[system]],
         root    = [[C:\Program Files (x86)\LuaRocks\systree]],
    },
}
variables = {
    MSVCRT = 'MSVCR80',
    LUALIB = [[lib\lua5.1.lib]],
    CFLAGS = '"-IC:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\include" "-IC:\\MinGW\\building\\libev-4.20"',
    CMAKE = '"C:\\Program Files (x86)\\CMake\\bin\\cmake.exe"'
}
verbose = true   -- set to 'true' to enable verbose output

luarocks install lua-ev (verbose=false)

C:\>luarocksw install lua-ev
executing: luarocks install lua-ev
Installing https://luarocks.org/lua-ev-v1.4-1.rockspec...
Using https://luarocks.org/lua-ev-v1.4-1.rockspec... switching to 'build' mode
Cloning into 'lua-ev'...
remote: Counting objects: 35, done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 35 (delta 5), reused 17 (delta 0), pack-reused 0 eceiving objects:  85% (30/35)
Receiving objects: 100% (35/35), 30.06 KiB, done.
Resolving deltas: 100% (5/5), done.
Note: checking out '458165bdfe0c6eadc788813925f11a0e6a823845'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

cl "-IC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" "-IC:\MinGW\building\libev-4.20" -c -Folua_ev.obj -IC:/Program Files (x86)/Lua/5.1/include/ lua_ev.c
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

lua_ev.c
C:\MinGW\building\libev-4.20\ev.h(931) : warning C4005: 'SIGABRT' : macro redefinition
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\signal.h(43) : see previous definition of 'SIGABRT'
C:\MinGW\building\libev-4.20\ev.h(996) : warning C4005: 'NSIG' : macro redefinition
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\signal.h(32) : see previous definition of 'NSIG'
link -dll -def:ev.def -out:ev.dll C:/Program Files (x86)/Lua/5.1/lib\lua5.1.lib lua_ev.obj ev.lib
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'ev.lib'

Error: Build error: Failed compiling module ev.dll
Press any key to continue . . .

Can't watch directories

You can't seem to watch directories:

ev = require"ev"
do -- Add getfd function to file namespace
    local ok , posix = pcall ( require , "posix" )
    if ok then
        getmetatable ( io.stdin ).__index.getfd = posix.fileno
    else
        error ( "Unable to watch file descriptors" )
    end
end
loop=ev.Loop.new()
fd=io.open(".")
io = ev.IO.new ( print , fd:getfd() , ev.READ +ev.WRITE )
io:start(loop)
loop:loop()
print("Should never get here")

Lua 5.2 Support

I was wondering if you have any plans to eventually update your library to support Lua 5.2? Right now I'm using Lua 5.1 but would like to understand if 5.2 support is on your road map for the future. My experiences with your binding to libev have been very positive and I look forward to its future development.

Thanks . . .

Async watchers for multi-threading.

Hi,

Currently the async watcher API doesn't seem to handle the use case of multi-threading synchronization (waking up the event loop from a different thread). Could it be implemented with the Lua C API in a flexible way to interface with threading libraries ? (open question)

Make package building with Lua 5.4

There are versions of Lua hard-coded into cmake/Modules/FindLua5X.cmake and Lua 5.4 is missing. Why don’t you use standard cmake/Modules/FindLua.cmake, by the way?

Anyway, this patch works around this problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.