UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStar™
https://usdx.eu
GNU General Public License v2.0
812 stars 160 forks source link

[Linux] Lua plugins don't initialize in native Linux (using Lua 5.3) #56

Closed RattleSN4K3 closed 4 years ago

RattleSN4K3 commented 8 years ago

Issue

Running USDX and trying to open the party screen, the message "No plugins loaded" is prompted. Checking the error log file shows entries like this for every installed plugin:

ERROR:  module 'Usdx.Party' not found:
    no field package.preload['Usdx.Party']
    no file '/usr/local/share/lua/5.3/Usdx/Party.lua'
    no file '/usr/local/share/lua/5.3/Usdx/Party/init.lua'
    no file '/usr/local/lib/lua/5.3/Usdx/Party.lua'
    no file '/usr/local/lib/lua/5.3/Usdx/Party/init.lua'
    no file '/usr/share/lua/5.3/Usdx/Party.lua'
    no file '/usr/share/lua/5.3/Usdx/Party/init.lua'
    no file './Usdx/Party.lua'
    no file './Usdx/Party/init.lua'
    no file '/usr/local/lib/lua/5.3/Usdx/Party.so'
    no file '/usr/lib/i386-linux-gnu/lua/5.3/Usdx/Party.so'
    no file '/usr/lib/lua/5.3/Usdx/Party.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './Usdx/Party.so'
    no file '/usr/local/lib/lua/5.3/Usdx.so'
    no file '/usr/lib/i386-linux-gnu/lua/5.3/Usdx.so'
    no file '/usr/lib/lua/5.3/Usdx.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './Usdx.so' [lua/party mode: 5000points]
ERROR:  error in plugin_init: /home/test/USDX/game/plugins/5000points.usdx [lua]

The plugin dump shows the same error for every plugin:

STATUS:   # Name                           Version  Status     Paused  #Errors [LuaCore Plugins]
STATUS:   0 party mode: 5000points         1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   1 party mode: 5000pointsblind    1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   2 party mode: deaf               1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   3 party mode: shortsong          1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   4 party mode: 500blind           1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   5 party mode: 1000blind          1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   6 party mode: teamduel           1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   7 party mode: blind              1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   8 party mode: hardcore           1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:   9 party mode: 7000points         1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  10 party mode: blindTotal         1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  11 party mode: blindLyrics        1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  12 party mode: holdthelineblind   0.6      error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  13 party mode: 5000pointsblind    1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  14 party mode: duel               1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  15 party mode: 2000points         1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  16 party mode: 2000pointsblind    1.00     error in plugin_init() False   1      [LuaCore Plugins]
STATUS:  17 party mode: holdtheline        0.6      error in plugin_init() False   1      [LuaCore Plugins]

The build is configured with the following log:

checking whether make sets $(MAKE)... yes
checking whether ln -s works... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for a BSD-compatible install... /usr/bin/install -c
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for fpc... fpc
checking for fpcmake... fpcmake
checking version of fpc... [3.0.0]
checking whether the Free Pascal Compiler works... yes
checking whether the Free Pascal Compiler can link... yes
checking whether FPC supports -k"-z noexecstack"... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for ranlib... ranlib
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libpng12... yes
checking version of libpng... [1.2.54]
checking for sdl2... yes
checking for SDL2_image... yes
checking for freetype2... yes
checking for sqlite3... yes
checking for lua5.3... yes
checking version of lua... [5.3.1]
checking for libavcodec... yes
checking version of libavcodec... [56.60.100]
checking for avcodec_decode_audio in -lavcodec... no
checking for avcodec_decode_audio2 in -lavcodec... no
checking for img_convert in -lavcodec... no
checking for libavformat... yes
checking version of libavformat... [56.40.101]
checking for libavutil... yes
checking version of libavutil... [54.31.100]
checking version of ffmpeg... [2.8]
checking for libswscale... yes
checking version of libswscale... [3.1.101]
checking for libprojectM >= 0.98... no
checking for portaudio-2.0... yes
checking version of portaudio... [19]
checking for libpcre... yes
checking version of libpcre... [8.38]
checking for portmixer... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/config-linux.inc
configure:
!!!
!!! Configuration of ultrastardx 1.1 done!
!!!
!!! Type "make" to compile and
!!!      "make install" to install it afterwards.
!!!
!!! For further information on ultrastardx visit:
!!!   http://www.ultrastardeluxe.org/
!!!
!!! In case you find a bug send a bugreport to:
!!!   http://sourceforge.net/tracker/?group_id=191560&atid=937872
!!! You might as well ask for help at the IRC-Channel
!!!   #ultrastardx at quakenet.org
!!!

Nothing special in the make file regarding Lua.

Confirming

Uninstalling 5.3 and installing 5.1 works. Plugins are loaded.

basisbit commented 8 years ago

I'd guess that the headers of Lua 5.3 has some changes that I missed when I tried my best at porting the fpc lua 5.1 headers to lua 5.2 and 5.3... I am very busy currently but will try to find someone who could take a look at that.

basisbit commented 8 years ago

got some feedback from an arch-linux user: installed ultrastardx-git from the aur. it uses lua 5.3.3 ("checking version of lua... [5.3.3]") and plugins are detected and work just fine.

Emily9121 commented 8 years ago

ArchLinux User here, Linux 4.6.3-1-ARCH #1 SMP PREEMPT Fri Jun 24 21:19:13 CEST 2016 x86_64 GNU/Linux

Can't reproduce, It seem to compile automatically to Lua 5.3.3, but even when I remove lua51 and lua52 package and THEN recompile USDX, Party Mode seem to work as expected.

RattleSN4K3 commented 8 years ago

Isn't the ultrastardx-git AUR installing lua51? (judging from the deps here).

I've installed the deps manually to most recent ones (since the list in the readme is a bit outdated).

From what I see, Ubuntu still uses 5.3.1, same for Debian (Jessie and wheezy). Probably only a temporary issues until derivates using the new version. Seems like a bug in 5.3.0< x <5.3.3.

Emily9121 commented 8 years ago

It normally do, for testing purpose however I edited my local pkgbuild to not mention lua51 as a dependence.

Back when USDX Lua detection at compilation was broken, the pkgbuild applied a patch to hardcode lua51, that's why the dependence, I should probably be updating it to depend of "lua" now.

EDIT: pkgbuild was updated to depend of lua instead of lua5.1.

basisbit commented 8 years ago

just tried here on ubuntu Testing + lua 5.3 and plugins still work. Can you please provide some more information on how to reproduce the issue?

RattleSN4K3 commented 8 years ago

5.3.x what? To reproduce, uninstall 5.3.x and force to install 5.3.1.

RattleSN4K3 commented 8 years ago

http://packages.ubuntu.com/search?suite=xenial&arch=i386&searchon=names&keywords=liblua

Remove 5.1 (or any other 5.3.x release). Using the packages from official sources, it'll install 5.3.1 by using: apt-get install -s liblua5.3

Inst liblua5.3-0 (5.3.1-1ubuntu2 Ubuntu:16.04/xenial [i386]) Inst liblua5.3-dev (5.3.1-1ubuntu2 Ubuntu:16.04/xenial [i386]) Inst liblua5.3-0-dbg (5.3.1-1ubuntu2 Ubuntu:16.04/xenial [i386])

Only if I install 5.1/5.2 it works.

s09bQ5 commented 6 years ago

In Lua 5.3 LUA_INTEGER and LUA_UNSIGNED may be 64 bit types. That's why TLuaCore.PrepareState fails to modify package.searchers.

s09bQ5 commented 6 years ago

Should be fixed by 33fe22e3cfae1d67a74c0caa0ef4727027c597c3. Please test.