LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   lua with cairo doesnt work in conky (http://www.linuxquestions.org/questions/slackware-14/lua-with-cairo-doesnt-work-in-conky-897868/)

Bindestreck 08-17-2011 11:36 AM

lua with cairo doesnt work in conky
 
Hi,

I try to use Lua with cairo in conky. But whenever I try to execute conky I get this error:
Code:

bash-4.1$ conky -c .conkyrc_test
Conky: llua_load: /home/expander/clock.lua:71: module 'cairo' not found:
        no field package.preload['cairo']
        no file './cairo.lua'
        no file '/usr/share/lua/5.1/cairo.lua'
        no file '/usr/share/lua/5.1/cairo/init.lua'
        no file '/usr/lib64/lua/5.1/cairo.lua'
        no file '/usr/lib64/lua/5.1/cairo/init.lua'
        no file '/usr/lib/conky/libcairo.so'
        no file './cairo.so'
        no file '/usr/lib64/lua/5.1/cairo.so'
        no file '/usr/lib64/lua/5.1/loadall.so'
Conky: desktop window (ac) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer

I have installed this dependencies:

lua
tolua++

I've also installed all possible cairo I found at SlackBuild:
cairo-compmgr
cairo-dock
cairo-dock-plugins
cairomm Libraries
perl-cairo

conky -v gives this:

Code:

bash-4.1$ conky -v
Conky 1.8.1 compiled Wed Aug 17 11:53:12 CEST 2011 for Linux 3.0.1-eXpander (x86_64)

Compiled in features:

System config file: /usr/etc/conky/conky.conf
Package library path: /usr/lib/conky

 X11:
  * Xdamage extension
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual

 Music detection:
  * MPD
  * MOC

 General:
  * math
  * hddtemp
  * portmon
  * config-output
  * Imlib2
  * apcupsd
  * iostats
  * ncurses
  * Lua

  Lua bindings:
  * Cairo
  * Imlib2

One can see that my conky should support Lua and with cairo bindings and Imlib2. What do I miss? Or is there a Lua5.1 package I need to install?

I appreciate any help, thanks.

larryhaja 08-17-2011 09:13 PM

Quote:

Originally Posted by eXpander_ (Post 4445655)
Code:

bash-4.1$ conky -c .conkyrc_test
Conky: llua_load: /home/expander/clock.lua:71: module 'cairo' not found:
        no field package.preload['cairo']
        no file './cairo.lua'
        no file '/usr/share/lua/5.1/cairo.lua'
        no file '/usr/share/lua/5.1/cairo/init.lua'
        no file '/usr/lib64/lua/5.1/cairo.lua'
        no file '/usr/lib64/lua/5.1/cairo/init.lua'
        no file '/usr/lib/conky/libcairo.so'
        no file './cairo.so'
        no file '/usr/lib64/lua/5.1/cairo.so'
        no file '/usr/lib64/lua/5.1/loadall.so'
Conky: desktop window (ac) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer


I actually don't know what is going on but it looks like you have conky in /usr/lib and the rest of the files in the list above in /usr/lib64. I would first fix that issue and then it might fix the problem or at least reduce the number of problem(s).

Root-Minuz 08-17-2011 10:00 PM

Can you post the contents of .conkyrc_test?

Might give a hint ;)
P.S: did you install conky from slakbuilds or from source?

Bindestreck 08-18-2011 04:21 AM

Quote:

Originally Posted by larryhaja (Post 4446132)
I actually don't know what is going on but it looks like you have conky in /usr/lib and the rest of the files in the list above in /usr/lib64. I would first fix that issue and then it might fix the problem or at least reduce the number of problem(s).

I did a "find / -name "conky"" and this is the result:
/usr/local/lib/conky
/usr/bin/conky

Is that correct or should conky be installed somewhere else? If I manually try to find the files above, this is the result:

Code:

bash-4.1# find / -name "cairo.lua"
#nothing

bash-4.1# find / -name "init.lua"
#nothing

bash-4.1# find / -name "libcairo.so"
/usr/lib/libcairo.so
/usr/local/lib/libcairo.so
/usr/lib64/libcairo.so


bash-4.1# find / -name "cairo.so"
#nothing

bash-4.1# find / -name "loadall.so"
#nothing

It did find libcairo.so, however in other directories. But none of the rest were found.

Quote:

Originally Posted by Root-Minuz (Post 4446158)
Can you post the contents of .conkyrc_test?

Might give a hint ;)
P.S: did you install conky from slakbuilds or from source?

I did install from source, but builded a package with src2pkg. Perhaps I should install from Slackbuild instead? But it seems that some cairo package is missing. When executing:
lua -l 'cairo', it gives same error.

Thanks for all your answers!

Bindestreck 08-18-2011 04:59 AM

I did compiled from SlackBuild with LUA=yes ./conky.SlackBuild. However, still same error.

When executing lua -l 'cairo' or lua -l 'imlib2' I get this errors:

Code:

bash-4.1$ lua -l 'cairo'
lua: module 'cairo' not found:
        no field package.preload['cairo']
        no file './cairo.lua'
        no file '/usr/local/share/lua/5.1/cairo.lua'
        no file '/usr/local/share/lua/5.1/cairo/init.lua'
        no file '/usr/local/lib/lua/5.1/cairo.lua'
        no file '/usr/local/lib/lua/5.1/cairo/init.lua'
        no file './cairo.so'
        no file '/usr/local/lib/lua/5.1/cairo.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: ?
        [C]: ?

bash-4.1$ lua -l 'imlib2'
lua: module 'imlib2' not found:
        no field package.preload['imlib2']
        no file './imlib2.lua'
        no file '/usr/local/share/lua/5.1/imlib2.lua'
        no file '/usr/local/share/lua/5.1/imlib2/init.lua'
        no file '/usr/local/lib/lua/5.1/imlib2.lua'
        no file '/usr/local/lib/lua/5.1/imlib2/init.lua'
        no file './imlib2.so'
        no file '/usr/local/lib/lua/5.1/imlib2.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: ?
        [C]: ?

I did find some "luacairo-1.10.2.0-src". But I get an error when trying to compile:

Code:

bash-4.1$ make
gcc -Wall -O2 -fPIC -c \
`pkg-config --cflags lua5.1` \
`pkg-config --cflags cairo` \
`pkg-config --cflags gtk+-2.0` \
`pkg-config --cflags gdk-2.0` \
lcairo.c
In file included from lcairo.c:193:0:
lcairo-ft-font.c:68:12: error: redefinition of 'l_cairo_ft_font_face_create_for_                                                                                                  pattern'
lcairo-ft-font.c:20:12: note: previous definition of 'l_cairo_ft_font_face_creat                                                                                                  e_for_pattern' was here
lcairo-ft-font.c:77:12: error: redefinition of 'l_cairo_ft_font_options_substitu                                                                                                  te'
lcairo-ft-font.c:27:12: note: previous definition of 'l_cairo_ft_font_options_su                                                                                                  bstitute' was here
In file included from lcairo.c:196:0:
lcairo-image-surface.c: In function 'l_cairo_image_surface_get_data':
lcairo-image-surface.c:85:5: warning: pointer targets in passing argument 2 of '                                  lua_pushlstring' differ in signedness
/usr/include/lua.h:163:16: note: expected 'const char *' but argument is of type                                    'unsigned char *'
lcairo.c: At top level:
lcairo-private.h:414:23: warning: 'l_cairo_xcb_device_debug_cap_xshm_version' de                                    clared 'static' but never defined
lcairo-private.h:415:23: warning: 'l_cairo_xcb_device_debug_cap_xrender_version'                                                                            declared 'static' but never defined
lcairo-ft-font.c:20:12: warning: 'l_cairo_ft_font_face_create_for_pattern' defin                                        ed but not used
lcairo-ft-font.c:27:12: warning: 'l_cairo_ft_font_options_substitute' defined bu                                        t not used
make: *** [lcairo.o] Error 1

I have no idea what to do.

*EDIT: Have anyone here managed to get lua-cario bindings to work with conky (Slackware 13.37)? If so, could you please share your lua-script and conkyrc-file?

ponce 08-18-2011 11:47 AM

cairo and imlib2 bindings for lua are bundled with conky (since 1.7.4), and normally you should have them installed in /usr/lib64/conky/.
I tried to follow the example here and works fine (besides the font).
I suspect you've got something wrong in your conky config files, but I don't use this so I cannot be of more help :(

Bindestreck 08-18-2011 12:05 PM

Quote:

Originally Posted by ponce (Post 4446778)
cairo and imlib2 bindings for lua are bundled with conky (since 1.7.4), and normally you should have them installed in /usr/lib64/conky/.
I tried to follow the example here and works fine (besides the font).
I suspect you've got something wrong in your conky config files, but I don't use this so I cannot be of more help :(

Hi,

thanks for your answer.

The problem on the lua example from http://wiki.conky.be/index.php?title=Lua_Cario_bindings, is the following row:

require 'cairo'

Im just wondering, do you have the listed files above? This files:

Code:

lua: module 'cairo' not found:
        no field package.preload['cairo']
        no file './cairo.lua'
        no file '/usr/local/share/lua/5.1/cairo.lua'
        no file '/usr/local/share/lua/5.1/cairo/init.lua'
        no file '/usr/local/lib/lua/5.1/cairo.lua'
        no file '/usr/local/lib/lua/5.1/cairo/init.lua'
        no file './cairo.so'
        no file '/usr/local/lib/lua/5.1/cairo.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'


ponce 08-18-2011 12:57 PM

I suspect you haven't created in your home the cairo.lua file required by the example (on that same page) and loaded in the rc by lua_load
Code:

lua_load ~/cairo.lua

Bindestreck 08-18-2011 01:02 PM

I put all the code from the example in a new file called cairo.lua. I also create that .conkyrc.cairo file. I do everything that says on the page... I still cannot get it to work. Then when I execute:
conky -d -f "Radio Space" -c .conkyrc.cairo

I get this:

Conky: llua_load: ./cairo.lua:3: loop or previous error loading module 'cairo'

???????

ponce 08-18-2011 01:06 PM

here works fine.
if the files are exactly the same as the guide, maybe it's because of all the stuff you installed before from source (always use slackbuilds): I would suggest you to try with a fresh account or with a fresh install.

Bindestreck 08-18-2011 01:14 PM

Thats the thing. I tried this on a newly fresh installed Slackware on a computer. Same error.

However, there is one thing that connect my laptop to that computer, both use custom compiled kernel 3.0.1. Maybe it has something to do with that?

ponce 08-18-2011 01:18 PM

no, 3.0.2-ck here, but I think it doesn't matter at all.
sorry if I repeat, it works on a fresh install with lua, tolua++ and conky, all from slackbuilds.org.
so if you tried, you got something else wrong (or you are using the same home for your user and what breaks it is there).

Bindestreck 08-18-2011 01:23 PM

No, it is two different, my laptop, and a stationary PC. On the stationary PC I installed lua, tolua++ from sbopkg and conky from SlackBuild. I installed conky with LUA=yes ./conky.SlackBuild.

Oh my...

Bindestreck 08-18-2011 02:19 PM

Just one last question, what is your Pixman and X.org version?

Mine is:

Code:

bash-4.1$ X -version

X.Org X Server 1.10.3
Release Date: 2011-07-08
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.37.6 x86_64
Current Operating System: Linux darkstar 3.0.1-eXpander #1 SMP PREEMPT Thu Aug 11 20:24:20 CEST 2011 x86_64
Kernel command line: BOOT_IMAGE=eXpander_3.0.1 ro root=802 vt.default_utf8=0
Build Date: 10 August 2011  11:34:34PM
 
Current version of pixman: 0.22.2
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.


ponce 08-19-2011 04:15 AM

I'm using the ones provided with slackware (I suppose you do not).


All times are GMT -5. The time now is 02:12 PM.