brndnmtthws / conky

Light-weight system monitor for X, Wayland (sort of), and other things, too
https://conky.cc
GNU General Public License v3.0
7.28k stars 620 forks source link

[Bug]: attempt to call a nil value (global 'cairo_xlib_surface_create') #1944

Closed ExecutorElassus closed 5 months ago

ExecutorElassus commented 5 months ago

What happened?

On conky-1.21.1, the following function:

function conky_main()
    if conky_window == nil then
        return
    end

    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local display = cairo_create(cs)

    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)

    if update_num > 5 then
        go_clock_rings(display)
        go_gauge_rings(display)
    end

    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

fails to draw the various graphs on my conky setup. I get the following error:

conky: llua_do_call: function conky_main execution failed: /home/elassus/.conky/conky_grey.lua:532: attempt to call a nil value (global 'cairo_xlib_surface_create')

Downgrading to conky stable (1.19.8) works around the problem.

I'm using conky on gentoo Linux. My settings are:

 # emerge -pv conky::gentoo

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 3.19 s (backtrack: 0/20).

[ebuild   R    ] app-admin/conky-1.19.8::gentoo  USE="X bundled-toluapp curl hddtemp iconv imlib lua-cairo lua-imlib lua-rsvg ncurses portmon rss truetype wayland -apcupsd -cmus -doc -extras -ical -intel-backlight -iostats -irc -math -moc -mpd -mysql -nvidia -pulseaudio -systemd -test -thinkpad -webserver -wifi -xinerama -xmms2" LUA_SINGLE_TARGET="lua5-4" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

Do I need to update the syntax here? Or is there something else wrong?

Version

1.21.1

Which OS/distro are you seeing the problem on?

Gentoo

Conky config

No response

Stack trace

No response

Relevant log output

No response

brndnmtthws commented 5 months ago

Add require 'cairo_xlib'. See https://github.com/brndnmtthws/conky/issues/1867.

ExecutorElassus commented 5 months ago

Sorry, my mistake (I posted the gentoo USE flags for 1.19.1, not 1.21.1). If I un-block 1.21.1, these are the USE flags:

 # emerge -pv conky

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 11.29 s (backtrack: 1/20).

[ebuild     U  ] app-admin/conky-1.21.1::gentoo [1.19.8::gentoo] USE="X bundled-toluapp colour-name-map%* curl hddtemp iconv imlib lua-cairo lua-cairo-xlib%* lua-imlib lua-rsvg ncurses portmon rss truetype wayland -apcupsd -cmus -doc -extras -ical -intel-backlight -iostats -irc -math -moc -mpd -mysql -nvidia -pulseaudio -systemd -test -thinkpad -webserver -wifi -xinerama -xmms2" LUA_SINGLE_TARGET="lua5-4" 0 KiB

Total: 1 package (1 upgrade), Size of downloads: 0 KiB

As you can see, lua-cairo-xlib is included. This does not resolve the issue (ie, I still get this error).

ExecutorElassus commented 5 months ago

whoops, sorry I misunderstood what you meant. I've added require 'cairo_xlib' at the top of the .lua file right below require 'cairo' and BOOM now it works. Thanks for sorting me out.

pallebone commented 4 months ago

You helped me also. Thank you, you are the legend until the day you die. Love you.