vis icon indicating copy to clipboard operation
vis copied to clipboard

compatible with Lua 5.3/5.4

Open starwing opened this issue 3 years ago • 6 comments

Lua 5.3/5.4 has some differences with Lua5.2:

  • unsigned version of API are removed
  • luaL_checkint removed

with this patch vis build succeed on Lua 5.4.1

starwing avatar Dec 08 '20 11:12 starwing

Could you please provide a bit more context? What is the exact error you got? Did you (re-)run ./configure?

603ee4688ca0da05840bbc15241ee53b02d0987d defines LUA_COMPAT_5_3 which should fix this the other way around i.e. by providing the deprecated legacy functions in term of newer ones.

I'm not necessarily saying that we shouldn't migrate to the newer interfaces. However, the current code (if compiled correctly) should already work with Lua 5.4.

martanne avatar Dec 08 '20 18:12 martanne

Sorry for the confusion :-)

I'm new to vis. When I first try to build vis, I noticed the compiling error repotting in #843, so I apply this change to support new interface. But after some tweak I rebuild the vis, I find that the build error is because the config.mk is not applying. After re-run configure (in another machine which without this patch) the build success.

So feel free with this patch, maybe I could help to make vis-lua.c compatible with all versions of Lua without add the COMPAT flags in config.mk

starwing avatar Dec 09 '20 00:12 starwing

What is the status of this PR? Shouldn’t it be closed? vis builds for me just fine with Lua 5.4 on openSUSE/Tumbleweed.

mcepl avatar Feb 05 '21 22:02 mcepl

What is the status of this PR? Shouldn’t it be closed? vis builds for me just fine with Lua 5.4 on openSUSE/Tumbleweed.

I still think we should use the new interface instead, because Lua_Unsigned will not belong to Lua any more. But it's up to the author to decide we use the newer interface or just using compatible flags to keep old interface.

So if @martanne think it's unnecessary, just feel free to close this pr :)

starwing avatar Feb 06 '21 08:02 starwing

Of course, and I wouldn’t mind to declare vis just follow the latest Lua (although, neovim with its reliance on LuaJIT has a point as well).

mcepl avatar Feb 06 '21 09:02 mcepl

I have been intrigued by a possibility of luajit, but it doesn’t seem to work:

abuild@stitny:~/rpmbuild/BUILD/vis-0.7+git.1651608857.d0808c7> ls -l /usr/lib*/liblua*
lrwxrwxrwx. 1 root root     18 May 15 03:33 /usr/lib64/liblua.so.5.4 -> liblua5.4.so.5.4.0
lrwxrwxrwx. 1 root root     18 May 15 03:33 /usr/lib64/liblua5.4.so.0 -> liblua5.4.so.5.4.0
lrwxrwxrwx. 1 root root     18 May 15 03:33 /usr/lib64/liblua5.4.so.5 -> liblua5.4.so.5.4.0
lrwxrwxrwx. 1 root root     18 May 15 03:33 /usr/lib64/liblua5.4.so.5.4 -> liblua5.4.so.5.4.0
-rwxr-xr-x. 1 root root 264248 May 15 03:33 /usr/lib64/liblua5.4.so.5.4.0
lrwxrwxrwx. 1 root root     22 Jul 17  2021 /usr/lib64/libluajit-5.1.so -> libluajit-5.1.so.2.1.0
lrwxrwxrwx. 1 root root     22 Jul 17  2021 /usr/lib64/libluajit-5.1.so.2 -> libluajit-5.1.so.2.1.0
-rwxr-xr-x. 1 root root 573216 Jul 17  2021 /usr/lib64/libluajit-5.1.so.2.1.0
abuild@stitny:~/rpmbuild/BUILD/vis-0.7+git.1651608857.d0808c7>
abuild@stitny:~/rpmbuild/BUILD/vis-0.7+git.1651608857.d0808c7> ./configure --enable-lua=yes
checking for C compiler... cc
checking whether C compiler works... yes
checking whether compiler accepts -Werror=unknown-warning-option... no
checking whether compiler accepts -Werror=unused-command-line-argument... no
checking whether linker accepts -Werror=unknown-warning-option... no
checking whether linker accepts -Werror=unused-command-line-argument... no
checking whether compiler accepts -pipe... yes
checking whether compiler accepts -O2... yes
checking whether compiler accepts -ffunction-sections... yes
checking whether compiler accepts -fdata-sections... yes
checking whether linker accepts -Wl,--gc-sections... yes
checking whether compiler accepts -fPIE... yes
checking whether compiler accepts -fstack-protector-all... yes
checking whether linker accepts -Wl,-z,now... yes
checking whether linker accepts -Wl,-z,relro... yes
checking whether linker accepts -pie... yes
creating config.mk... done
checking for pkg-config... yes
checking for libcurses...
 checking for ncursesw... yes
checking for libtermkey... yes
checking for libtre... yes
checking for liblua >= 5.2 ...
 checking for lua... no
 checking for lua5.4... no
 checking for lua5.3... no
 checking for lua5.2... no
 checking for lua-5.3... no
 checking for lua-5.2... no
 checking for lua54... no
 checking for lua53... no
 checking for lua52... no
./configure: cannot find liblua
abuild@stitny:~/rpmbuild/BUILD/vis-0.7+git.1651608857.d0808c7>

mcepl avatar May 16 '22 21:05 mcepl

I'm going to close this for now since it doesn't simplify any code or fix any current issues. Lua 5.1 is still supported pretty much everywhere and even if that stops there is still LuaJIT.

This can be revisited in the future if it ever actually matters (i.e. vis' Lua support ends up broken or updating offers some big benefit to vis).

rnpnr avatar Jul 17 '23 15:07 rnpnr