1

I am trying to configure conky to work with cairo, I added "require 'libcairo'" to the top of the default .conkyrc to make sure it would load, however, when I run conky, it gives me this error:

error loading module 'libcairo' from file './libcairo.so':
./libcairo.so: undefined symbol: luaopen_libcairo

I have been browsing other related questions, and most suggest that the lua version and cairo library are mismatched. I have ensured that i am using Lua 5.3 and i compiled the latest version of Cairo from the tarball on their downloads page (version 1.17.4).

I tried using the Lua interpreter to load the module and determine what was actually causing the error, however when i give it

>require 'libcairo'

it returns the same error.

After purging and reinstalling conky, lua, and libcairo, it still is not working. I do not know where I am going wrong but I would be happy to provide any info the reader will need to help.

EDIT: I should add that I am using Arch with KDE5

  • What Lua binding for Cairo have you built? – Alexander Mashin Jan 18 '21 at 03:46
  • 1
    You need to use `require 'cairo'`, not libcairo. – meuh Jan 18 '21 at 07:35
  • @meuh, the only libraries that were installed 'libcairo'. a serch on my machine turned up no libraries by the name 'cairo'. – Brian Thomas Jan 18 '21 at 07:45
  • @AlexanderMashin forgive me if i sound ignorant, but i do not know what a Lua binding is. I have 0 experience with Lua. – Brian Thomas Jan 18 '21 at 07:48
  • I understood that "lib" will be added automatically to the require argument. All the conky examples seem to use `require 'cairo'`, not `require 'libcairo'`. – meuh Jan 18 '21 at 08:02
  • If `require 'cairo'` fails, try `require 'Cairo'`. – Alexander Mashin Jan 18 '21 at 10:10
  • When you built conky from source, did you enable the `BUILD_LUA_CAIRO` flag? https://github.com/brndnmtthws/conky/wiki/Installation#build_flags You'd also need the dev-headers for that `sudo apt install libcairo2-dev` – Doyousketch2 Jan 18 '21 at 14:07
  • @AlexanderMashin, capitalizing Cairo also did help, but here in the comments I see that i likely made two errors: I didn't build conky with proper flags, i didn't install dev headers for libcairo2 I will try both of these things and report back here once I've finished – Brian Thomas Jan 20 '21 at 02:49
  • @Doyousketch2 Sorry, i didn't clarify, I did not compile Conky from source, i used pacman to install it. I however will try building it from source to see if that clears the issue. Please indulge me on how to enable specific build flags? i checked the README and some other places but it only shows me how to list them. I'll play around with it till i figure it out, but if you get to this before that I'd like to know. Thank you! – Brian Thomas Jan 20 '21 at 03:06

2 Answers2

0
sudo apt install libcairo2-dev

You've probably done these following commands, but the difference is in the cmake.
Just include -D then the name of the flag you wish to use.

mkdir build  
cd build  
cmake -DBUILD_LUA_CAIRO=true ..  
nice make -j$(nproc)  
sudo make install  

https://github.com/brndnmtthws/conky/blob/master/cmake/ConkyBuildOptions.cmake


Cairo possibly needs Pango. I won't say you have to install it, but if the above command doesn't get you where you're going, then I'd look at pango / freetype libs as a possible source as to why.

sudo apt install libpango1.0-dev
cmake -DBUILD_LUA_CAIRO=true -DBUILD_XFT=true ..
Doyousketch2
  • 2,060
  • 1
  • 11
  • 11
0

On Pop!_OS 21.04 (= Ubuntu 20.04 plus some extras) I simply had to install the conky-all package, it uninstalls conky-std which does not work with Cairo.

mok0
  • 1,101
  • 1
  • 9
  • 8