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

[Bug]: Some Lua binding symbol names are mangled in C++ compilation #1749

Closed
Suyooo opened this issue Feb 25, 2024 · 1 comment · Fixed by #1750
Closed

[Bug]: Some Lua binding symbol names are mangled in C++ compilation #1749

Suyooo opened this issue Feb 25, 2024 · 1 comment · Fixed by #1750
Labels
bug related to incorrect existing implementation of some functionality

Comments

@Suyooo
Copy link
Contributor

Suyooo commented Feb 25, 2024

What happened?

Since commit e4bdabc (Compile tolua++ output as C++), conky cannot find the luaopen_cairo symbol needed to initialize cairo, because the C++ compilation mangles the symbol name. Manually editing the tolua++ output to replace TOLUA_API with extern "C" fixes the problem, so it might be something that has to be changed in tolua++ more than conky itself.

Version

Git main branch (56a81ef)

Which OS/distro are you seeing the problem on?

Debian testing

Conky config

Minimal reproduction:

conky.config =
{
	own_window = true,
	lua_load = "test.lua",
	lua_draw_hook_post = "main",
}
conky.text = [[ ]];

test.lua

require 'cairo'

function conky_main()
	print("hello world")
end

Relevant log output

conky: desktop window (1e3) is root window
conky: window type - desktop
conky: drawing to created window (0x4e00002)
conky: drawing to double buffer
conky: llua_load: error loading module 'cairo' from file '/usr/local/lib/conky/libcairo.so':
	/usr/local/lib/conky/libcairo.so: undefined symbol: luaopen_cairo
conky: llua_do_call: function conky_main execution failed: attempt to call a nil value

Mangled symbols in libcairo.so:

$ nm -gD /usr/local/lib/conky/libcairo.so | grep _Z
0000000000012f40 T _Z13luaopen_cairoP9lua_State
0000000000010370 T _Z16tolua_cairo_openP9lua_State
00000000000102a0 T _Z21create_cairo_matrix_tv
0000000000010340 T _Z22destroy_cairo_matrix_tP13_cairo_matrix
0000000000010260 T _Z27create_cairo_font_extents_tv
0000000000010220 T _Z27create_cairo_text_extents_tv
0000000000010310 T _Z28destroy_cairo_font_extents_tP20cairo_font_extents_t
00000000000102e0 T _Z28destroy_cairo_text_extents_tP20cairo_text_extents_t
                 U _ZdaPv@GLIBCXX_3.4
                 U _Znam@GLIBCXX_3.4
                 U _Znwm@GLIBCXX_3.4
@brndnmtthws brndnmtthws added the bug related to incorrect existing implementation of some functionality label Feb 25, 2024
brndnmtthws added a commit that referenced this issue Feb 25, 2024
@brndnmtthws
Copy link
Owner

Of course, this seems obvious in hindsight.

I think #1750 should resolve it.

brndnmtthws added a commit that referenced this issue Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug related to incorrect existing implementation of some functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants