Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua 5.3 support #116

Closed
ghost opened this issue Jul 21, 2015 · 13 comments
Closed

Lua 5.3 support #116

ghost opened this issue Jul 21, 2015 · 13 comments

Comments

@ghost
Copy link

ghost commented Jul 21, 2015

Is there a specific reason why there is no native Lua 5.3(.1) support in Conky?

In the arch repositories there is currently a patch to make conky compile with Lua 5.3(.1) but this does not work when enabling the Conky Lua bindings: cairo, imlib2 and rsvg. (I assume they need to be updated)


The patch to get Conky 1.10 to compile with Lua 5.3(.1) (no Conky Lua bindings): https://projects.archlinux.org/svntogit/packages.git/tree/trunk/lua53.patch?h=packages/conky

Edit: The Lua 5.3 patch was actually already posted here: #90 and here #100


The error i get while trying to compile Conky 1.10 (with the Lua patch, and some others) and Lua 5.3.1 with the Conky Lua bindings cairo, imlib2 and rsvg enabled:

Linking CXX executable conky
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_map.o): In function `tolua_bnd_setpeer':
(.text+0x76): undefined reference to `lua_setfenv'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_map.o): In function `mapinheritance':
(.text+0x468): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_map.o): In function `mapsuper':
(.text+0x5d6): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_map.o): In function `tolua_bnd_getpeer':
(.text+0x62a): undefined reference to `lua_getfenv'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_map.o): In function `tolua_dobuffer':
(.text+0x10b7): undefined reference to `luaL_loadbuffer'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_map.o): In function `tolua_dobuffer':
(.text+0x10d3): undefined reference to `lua_pcall'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_push.o): In function `tolua_pushusertype':
(.text+0xf7): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_push.o): In function `tolua_pushusertype':
(.text+0x1c6): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_push.o): In function `tolua_pushusertype':
(.text+0x214): undefined reference to `lua_setfenv'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_push.o): In function `tolua_pushusertype':
(.text+0x188): undefined reference to `lua_remove'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_to.o): In function `tolua_tofieldnumber':
(.text+0x21e): undefined reference to `lua_tonumber'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_to.o): In function `tolua_tonumber':
(.text+0x44): undefined reference to `lua_tonumber'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `module_newindex_event':
(.text+0xb8): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `module_newindex_event':
(.text+0x139): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `module_index_event':
(.text+0x25b): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `module_index_event':
(.text+0x27e): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `do_operator':
(.text+0x2e9): undefined reference to `lua_remove'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `do_operator':
(.text+0x378): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_eq_event':
(.text+0x421): undefined reference to `lua_remove'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_eq_event':
(.text+0x4b8): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_call_event':
(.text+0x537): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_call_event':
(.text+0x54f): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `storeatubox.constprop.3':
(.text+0x56a): undefined reference to `lua_getfenv'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `storeatubox.constprop.3':
(.text+0x5b3): undefined reference to `lua_setfenv'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `storeatubox.constprop.3':
(.text+0x5c0): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_index_event':
(.text+0x639): undefined reference to `lua_getfenv'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_index_event':
(.text+0x6fd): undefined reference to `lua_remove'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_index_event':
(.text+0x811): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_index_event':
(.text+0x845): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_index_event':
(.text+0x888): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_newindex_event':
(.text+0x967): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_newindex_event':
(.text+0x9c5): undefined reference to `lua_remove'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_newindex_event':
(.text+0xa5f): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_event.o): In function `class_gc_event':
(.text+0xb59): undefined reference to `lua_call'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_is.o): In function `tolua_typename':
(.text+0x142): undefined reference to `lua_insert'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_is.o): In function `push_table_instance':
(.text+0x374): undefined reference to `lua_replace'
/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../lib/libtolua++.a(tolua_is.o): In function `tolua_isusertable':
(.text+0x658): undefined reference to `lua_insert'
collect2: error: ld returned 1 exit status
src/CMakeFiles/conky.dir/build.make:1427: recipe for target 'src/conky' failed
make[2]: *** [src/conky] Error 1
CMakeFiles/Makefile2:486: recipe for target 'src/CMakeFiles/conky.dir/all' failed
make[1]: *** [src/CMakeFiles/conky.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2

Maybe i should have posted this in the arch repository but i figured it would be better if Conky was patched for Lua 5.3 for everyone instead of just the arch repositories.

@Vallimar
Copy link
Contributor

That looks like a library linking issue. You need to modify cmake/ConkyPlatformChecks.cmake for this. This seems to work for me:

diff -aur old/cmake/ConkyPlatformChecks.cmake new/cmake/ConkyPlatformChecks.cmake
--- old/cmake/ConkyPlatformChecks.cmake 2015-04-27 03:53:15.546870016 -0400
+++ new/cmake/ConkyPlatformChecks.cmake 2015-04-27 03:53:45.039446214 -0400
@@ -249,7 +249,7 @@ if(BUILD_X11)
        endif(X11_FOUND)
 endif(BUILD_X11)

-pkg_search_module(LUA REQUIRED lua5.2 lua-5.2 lua>=5.1 lua5.1 lua-5.1)
+pkg_search_module(LUA REQUIRED lua5.3 lua-5.3 lua5.2 lua-5.2 lua>=5.1 lua5.1 lua-5.1)
 set(conky_libs ${conky_libs} ${LUA_LIBRARIES})
 set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS})
 link_directories(${LUA_LIBRARY_DIRS})

@ghost
Copy link
Author

ghost commented Jul 23, 2015

Still doesn't seem to compile for me, i get the exact same error. I also had to add lua>=5.3 since i use 5.3.1.
I even tried pkg_search_module(LUA REQUIRED lua>=5.3) to make sure it finds the right version (i have 5.1, 5.2 and 5.3 installed) but it resulted in the same error.
(on the checking for the modules 'lua>=5.3' there is no error, so it finds lua 5.3.1)
Might be something on my end, since you manage to build it?

On a side note, shouldn't lua>=5.2 be added to the list as wel?


Edit: Seems like the tolua++ lib would need an upgrade and is no longer maintained; and Lua won't provide the C/C++ bindings themselves.
Source: urho3d/urho3d#766
Source: http://lua-users.org/lists/lua-l/2013-01/msg00362.html (discurrages the use of tolua++ all together)
Source: http://lua-users.org/lists/lua-l/2013-01/msg00357.html

So i guess we can compile Conky with lua 5.3.1 but won't be able to use the cairo, imlib or rsvg build flags? Feel free to correct me if i'm wrong.

@Vallimar
Copy link
Contributor

Ahh, I don't use those. Try with luajit instead (will need to adjust the search path)?

@ghost
Copy link
Author

ghost commented Jul 24, 2015

LuaJit uses 5.1 and has 5.2 compatibility (not that great i hear, no experience myself though) but not 5.3 so i guess that's why it runs if you use LuaJit?
Source: https://www.reddit.com/r/lua/comments/2zutj8/mike_pall_luajit_dislikes_lua_53/

I must note i'm far from an expert on the matter, so my information might be incomplete.

The reason i'm asking for Lua 5.3 support (with the bindings) in the first place is because i've ported a C lib to work with Lua 5.3 which will be called in a Lua script called by Conky and i want people to be able to use it out of the box (uses cairo). But it seems by best bet will be to remake the bindings for Lua 5.1 and let Conky execute it's lua scripts in 5.1 and just hope most default repositories will do the same?


For the record building rsvg gives warnings (just thought i would mention it):

Building C object lua/CMakeFiles/conky-rsvg.dir/librsvg.c.o
/home/nooby4ever/Desktop/conky-lua-nv/src/conky-1.10.0/lua/librsvg.c: In function 'tolua_rsvg_g_type_init00':
/home/nooby4ever/Desktop/conky-lua-nv/src/conky-1.10.0/lua/librsvg.c:802:4: warning: 'g_type_init' is deprecated [-Wdeprecated-declarations]
    g_type_init();
    ^
In file included from /usr/include/glib-2.0/gobject/gobject.h:24:0,
                 from /usr/include/glib-2.0/gobject/gbinding.h:29,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from /usr/include/librsvg-2.0/librsvg/rsvg.h:31,
                 from /home/nooby4ever/Desktop/conky-lua-nv/src/conky-1.10.0/lua/librsvg.c:17:
/usr/include/glib-2.0/gobject/gtype.h:681:23: note: declared here
 void                  g_type_init                    (void);

Found this, might given alternatives for tolua++: http://lua-users.org/wiki/BindingCodeToLua

@antonio-malcolm
Copy link
Contributor

I encountered this same issue, after the latest update to Conky, and have a fix, if you're willing to compile tolua++ (AKA, toluapp) from source.

BTW, I'm also rolling in imlib2 and rsvg, as well as xdbe and xshape.

A fix for this is simply to compile both tolua++ AND Conky against lua5.1 ONLY.
Come to thinK of it, tolua++, IIRC, won't even compile against anything newer than 5.1.

(Side note: I also compile tolua from source, but it compiles just fine agains lua 5.3.x)

I'm not sure if we'd be missing out on something, by not compiling Conky against a newer version... better performance, maybe? My Conky install doesn't appear to use many resources. (Admittedly, I skip most of the application and network-centric configuration options- they're old, sometimes difficult to support, and I write my own in POSIX, then make calls to them in my Lua code, which provides MUCH greater customization). That said, if there are real advantages to building it against a new version of Lua, which don't introduce headaches, I'm all ears!

This project, in order to provide langauge bindings, for output to Cairo, relies on two others, one which hasn't been updated in two years, another which hasn't seen an update in at least three (with most of the code sitting at five) and, as mentioned, won't even compile against a modern version of Lua.

Depending on whether or not tolua and tolua++ are used by projects, outside of Conky, which are popular enough to make the work worthwhile, tolua and tolua++ may as well be considered abandonware. This tells us there's probably quite a bit of work to be done (the refactoring and replacement of a LOT of outdated code), because Conky needs to integrate another means of talking to Cairo.

TL;DR:
Here's the Github Wiki for making compilation with the Lua bindings work:

https://github.com/antonio-malcolm/conky-configs/wiki/How-To-Compile-Conky-And-Its-Lua-Bindings-From-Source

@marcpayne
Copy link
Contributor

This morning, I successfully compiled conky with BUILD_LUA_CAIRO, BUILD_LUA_IMLIB2, and BUILD_LUA_RSVG enabled, and there were no errors. I noticed the tolua++ package in the Arch community repo was updated a few days ago. Please see this page for the changes.

I had to make the following changes to ConkyPlatformChecks.cmake:

diff --git a/cmake/ConkyPlatformChecks.cmake b/cmake/ConkyPlatformChecks.cmake
index 2bf4c0a..b6c6d80 100644
--- a/cmake/ConkyPlatformChecks.cmake
+++ b/cmake/ConkyPlatformChecks.cmake
@@ -365,11 +365,11 @@ if(WANT_LIBXML2)
 endif(WANT_LIBXML2)

 if(WANT_TOLUA)
-       find_program(APP_TOLUA NAMES tolua++ tolua++5.1 tolua++-5.1)
+       find_program(APP_TOLUA NAMES toluapp tolua++ tolua++5.1 tolua++-5.1)
        if(NOT APP_TOLUA)
                message(FATAL_ERROR "Unable to find program 'tolua++'")
        endif(NOT APP_TOLUA)
-       find_library(TOLUA_LIBS NAMES tolua++ tolua++5.1 tolua++-5.1)
+       find_library(TOLUA_LIBS NAMES toluapp tolua++ tolua++5.1 tolua++-5.1)
        find_path(TOLUA_INCLUDE_PATH tolua++.h ${INCLUDE_SEARCH_PATH})
        if(TOLUA_INCLUDE_PATH AND TOLUA_LIBS)
                set(TOLUA_FOUND true)

@plikhari
Copy link

Fantastic - that worked :)

@marcpayne
Copy link
Contributor

I forgot to mention that I also had to force conky to compile against Lua 5.1 in order to actually use the bindings and avoid segfaults. Thanks @antonio-malcolm for the wiki page you wrote.

@antonio-malcolm
Copy link
Contributor

@marcpayne Not a problem! Likewise, thanks for mentioning the the update to ConkyPlatformChecks.cmake. I hadn't noticed the issue, until I attempted updating the Void repos; without the edit, conky and toluapp compile, by hand, and run fine, with everything installed under /usr/local, but the conky compile breaks, otherwise. Strange stuff.

EDIT: Looks like ConkyPlatformChecks.cmake was updated just two days ago. That explains why my previous build was working. Forked the repo, applied the fix, and made a pull request.

marcpayne added a commit to marcpayne/conky that referenced this issue Dec 11, 2015
The cairo/imlib2/rsvg bindings require tolua++ [1], which is currently
only compatible with Lua 5.1 or earlier. We need to force Conky to compile
against Lua 5.1 if the user chooses to build the bindings. See [2] and [3]
for some discussion on this topic.

This commit adds a separate pkg_search_module command specifically for Lua 5.1,
along with a note in the documentation. The original pkg_search_module command
was updated to include (and prefer) Lua 5.3+. Also, I threw in two other minor
random fixes to the docs while I was at it.

[1] https://github.com/LuaDist/toluapp
[2] brndnmtthws#116
[3] brndnmtthws#174
@apitofme
Copy link

Just looking at the link referenced by Nooby4Ever (http://lua-users.org/wiki/BindingCodeToLua)
...
Are there any specific functions and/or functionality offered by tolua++ (and required by Conky) above and beyond that of the basic C/C++ support offered by tolua?

-- I'm not exactly a LUA or C/C++ programmer so I can't answer this for myself, but if there are parts of tolua++ that are essential to Conky we must then look to see if one of the alternative C++ "Automatic binding generators" could be used in it's place ... right?

@antonio-malcolm
Copy link
Contributor

From building and running them together, my understanding is that tolua++ (A.K.A. toluapp), which normally uses lua5.1, will use tolua, if it's available, which, in-turn, uses lua5.2. This all sounds counterintuitive, unitl one realizes, somewhere along the way, tolua was updated to use lua5.2, and tolua++ was not. Conky will not have lua binding without tolua++. It would be great if the maintainers would update both tolua and tolua++, to keep them current, or if someone with the bandwidth would fork them. I would certainly do it, if I had the time. Maybe, once I get one or two projects I've been working on, already, out the door...

@lasers
Copy link
Contributor

lasers commented Aug 6, 2018

Hi everybody. Where do we stand here today? Keep this open or close?

@plikhari
Copy link

plikhari commented Aug 6, 2018

On Arch Linux have a look at this link my AUR packages

We need to patch conky and tolua++. These patches have their origin in the Fedora project - I found during testing conkywx that Fedora was using lua 5.3 ...

brndnmtthws pushed a commit that referenced this issue Dec 19, 2018
brndnmtthws added a commit that referenced this issue Dec 19, 2018
brndnmtthws added a commit that referenced this issue Dec 19, 2018
brndnmtthws added a commit that referenced this issue Dec 19, 2018
brndnmtthws added a commit that referenced this issue Dec 19, 2018
brndnmtthws added a commit that referenced this issue Dec 19, 2018
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
brndnmtthws added a commit that referenced this issue Dec 20, 2018
With this change, support for Lua 5.1 is dropped.

This resolve #116.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants