简体   繁体   English

Lua 无法打开 libcairo 并出现错误“未定义符号:luaopen_libcairo”

[英]Lua cannot open libcairo with error "undefined symbol: luaopen_libcairo"

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:我正在尝试将 conky 配置为与 cairo 一起使用,我在 default.conkyrc 的顶部添加了“require 'libcairo'”以确保它会加载,但是,当我运行 conky 时,它给了我这个错误:

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.一直在浏览其他相关问题,大部分都提示lua版本和cairo库不匹配。 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).我确保我使用的是 Lua 5.3,并且我从他们下载页面上的 tarball 编译了最新版本的 Cairo(版本 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我尝试使用 Lua 解释器来加载模块并确定实际导致错误的原因,但是当我给它时

>require 'libcairo'

it returns the same error.它返回相同的错误。

After purging and reinstalling conky, lua, and libcairo, it still is not working.清除并重新安装 conky、lua 和 libcairo 后,它仍然无法正常工作。 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编辑:我应该补充一点,我正在使用带有 KDE5 的 Arch

sudo apt install libcairo2-dev

You've probably done these following commands, but the difference is in the cmake.您可能已经完成了以下这些命令,但不同之处在于 cmake。
Just include -D then the name of the flag you wish to use.只需包含-D然后是您要使用的标志的名称。

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 https://github.com/brndnmtthws/conky/blob/master/cmake/ConkyBuildOptions.cmake


Cairo possibly needs Pango.开罗可能需要 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.我不会说你必须安装它,但如果上面的命令没有让你到达你要去的地方,那么我会将 pango / freetype 库作为可能的来源来解释原因。

sudo apt install libpango1.0-dev
cmake -DBUILD_LUA_CAIRO=true -DBUILD_XFT=true ..

On Pop._OS 21.04 (= Ubuntu 20,04 plus some extras) I simply had to install the conky-all package.在 Pop._OS 21.04(= Ubuntu 20,04 加上一些额外的)上,我只需要安装 conky-all package。 it uninstalls conky-std which does not work with Cairo.它卸载了不适用于开罗的 conky-std。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM