[vlc-devel] [PATCH] Revert "lua: don't call directly config_GetLibDir"

Rémi Denis-Courmont remi at remlab.net
Tue Aug 1 18:44:08 CEST 2017

Le tiistaina 1. elokuuta 2017, 10.57.56 EEST Nicolas Chauvet a écrit :
> 2017-07-31 17:08 GMT+02:00 Rémi Denis-Courmont <remi at remlab.net>:
> > Le maanantaina 31. heinäkuuta 2017, 11.57.18 EEST Nicolas Chauvet a écrit 
> >> This fix lua modules loading such as http interface and youtube scripts.
> >> 
> >> libdir and datadir are differents kind of directories on Linux.
> >> The former is for arch dependent content whereas the latter is arch
> >> indenpendent
> >> 
> >> In the case of luac files, the man luac page says
> >> "Precompiled chunks are not portable across different architectures."
> >> https://www.lua.org/manual/5.3/luac.html
> >> So theses files qualifies as been located in a "libdir" directory
> > 
> > How so? VLC explicitly forces the 32-bits scalar ABI for Lua byte code,
> > and
> > only officially supports little endian (patch welcome to fix big endian).
> > This is necessary to exchange third-party Lua scripts.
> > 
> > So AFAIK, VLC Lua byte code is architecture-independent, and that is very
> > much by design.
> Older lua man pages (<=5.1) said lua byte code "are portable only
> among architectures with the same word size and byte order."
> https://www.lua.org/manual/5.1/luac.html

Yes, Lua 5.1 bytecode depends on the size and byte order of a few Lua scalar 

> But there is no mention of OS compatibility, or compatibility across
> lua version.

The byte code does not depend on the OS. There is _no_ compatibility across 
versions in either source or byte code.

> This is not the case anymore with lua 5.2 and later, as quoted earlier.
> I don't expect I can have 32bit lua 5.2 on ppc64le or aarch64 anyway...
> So, if targeting portability is the aim, isn't that more efficient to
> use plain lua text files instead ?

I won´t recommend source code because it makes loading significantly slower. 
And it would be rather presomptuous of me to mandate what scripts authors 
would deliver.

All VLC builds by VideoLAN, and almost all VLC builds by anybody for 32-bits 
little endian platforms, support Lua 5.1 32-bits little-endian byte code.

Of course, we will have to break compatibility at some point to introduce 
newer a Lua version, and we might use it as an opportunity to upgrade to 64-
bits - maybe with VLC 4.0.0. Still, the only dependency, at least within our 
builds, lies on the major VLC version, not on the host platform.


More information about the vlc-devel mailing list