thezbyg / gpick

Advanced color picker written in C++ using GTK+ toolkit
BSD 3-Clause "New" or "Revised" License
376 stars 33 forks source link

README doesn't mention lua-c++ requirement #217

Open ryandesign opened 1 year ago

ryandesign commented 1 year ago

The README mentions that lua is required, but since gpick 0.3 it requires lua-c++ which is not in a standard lua install. The README should mention this unusual requirement, possibly with pointers on how to install lua-c++.

MarcusCalhoun-Lopez commented 1 year ago

https://github.com/thezbyg/gpick/commit/a8bc29c60d57933d9e8e8cb930d8e06586e0d315 muddies the issue a bit. If Lua is built with C++, surrounding the Lua headers with extern "C" { means the name mangled symbols are not found.

thezbyg commented 1 year ago

@ryandesign I agree that README should mention that C++ Lua library variant is required and will soon improve it.

@MarcusCalhoun-Lopez C++ Lua library can have unmangled symbols but it requires patched src/luaconf.h file (see https://sources.debian.org/patches/lua5.4/5.4.4-3/0003-extern_C.patch/). If symbols are mangled then extern "C" { will have to be removed from src/Lua.h file. Different Linux distributions do different things, but if this patch is only applied on Debian/Ubuntu then I could add a new build option to specify which type of Lua library will be linked.

Non C++ Lua library could also be used, but it would leak memory on Lua errors, because Lua uses different error handling method depending on used compiler. C version uses longjump and C++ version uses exceptions. If some C++ function expects to release allocated memory on exit from function or scope, then this release will not happen if longjump is used, because a simple jump to Lua error handling code will be performed.