Giter Site home page Giter Site logo

Comments (23)

paintdream avatar paintdream commented on June 1, 2024 4

So I could declare that this project supports linux game too XD.
Project description modified.

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024 2

Are you trying to start linux game (not dedicated server) with libpreload.so? Oh that's not work since the game requests steam to restart it if it was not started by steam. As a result, LD_PRELOAD will be missing when steam starts it.

Just tried a workaround and it worked (game starts, and salutes Mike Pall) for the Linux game itself in Debian testing (cannot test Debian Stable easily since that server is a headless VPS) using lib32readline8. Here are the steps:

  1. Download the .zip from Release and copy the three lib*.so files into [game]/bin/lib32/
  2. Install the available lib32readline library (first do apt search lib32readline then install the one available with sudo apt install lib32readline7 or sudo apt install libreadline8 depending on which one is available
  3. Mask as libreadline.so.6 with sudo ln -s /lib32/libreadline.so.7 /lib/i386-linux-gnu/libreadline.so.6 (note that 7 could be 8 if 8 was available and installed in the previous step)
  4. Rename dontstarve_steam to dontstarve_steam.bin
  5. Create a bash script called dontstarve_steam:
    #!/bin/sh
    LD_PRELOAD=./lib32/libpreload.so ./dontstarve_steam.bin
    
  6. Make that script executable with chmod +x ./dontstarve_steam
  7. Run the game as normal and enjoy!

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024 1

BTW, your steps in the project README.md points to creating a symlink to /lib32. I tried that earlier (but didn't report it to keep us focused). For some reason, it didn't work --- ldd didn't find the library in /lib32. Symlinking into /lib/i386-linux-gnu/` worked. Also, maybe consider automating this Linux setup with a bash script so non-developer players can play the game --- players really shouldn't be scared away from Linux by people like us pushing them to drop to terminal whenever something needs to be done.

Different linux players may have different startup scripts. My Chinese friends apply this mod to thier highly customized cluster and it is hard to code a uniform script. I think most linux players could handle it themselves ...

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024 1

Hmm, I'll keep an eye on the CPU usage when I do the comparison next time. Is the game too large and not written with optimization in mind s.t. garbage collection accidentally collections stuff that it shouldn't?

The best practice for scripting is to use more pools to cache objects that can be garbage collected and reuse them if necessary However, neither Klei nor most mod developers obay this term, resulting in frequently garbage collection and framedrops.

To make things worse, Klei establish an OOP-like system, which abuses metatables and make it difficult for LuaJIT to jit them. Then they do complicated table lookup via chain expression such as repeating "xxx.inst.components.do_something" without extract "xxx.inst.components" to a local variable, wasting too much time on hash lookup which blocks LuaJIT away from accelerating.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024 1

The issue is too long to load for browser, close.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

There is a typo in your command. It's LD_PRELOAD, not LS_PRELOAD when applying libreadline8

I used to consider providing libreadline6 but I am not sure if it was portable for all linux distributions. Some linux versions are not released with libreadline's dependences. Compiling it from source seems to be the best practice in linus' world. :)

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Ouch, so sorry! Still didn't work though.

$ LD_PRELOAD=libpreload.so ls
ERROR: ld.so: object 'libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
libfmodevent.so*       libfmodex.so*  liblua51.so    libreadline.so.6@  libsteam_api.so*
libfmodex-4.44.64.so*  liblua51DS.so  libpreload.so  libSDL2-2.0.so.0*  libsteamnetworkingsockets.so*
$ ldd liblua51DS.so
        linux-gate.so.1 (0xf7fbf000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7e52000)
        libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7e4c000)
        libreadline.so.6 => /lib/i386-linux-gnu/libreadline.so.6 (0xf7dfc000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7c18000)
        /lib/ld-linux.so.2 (0xf7fc1000)
        libtinfo.so.6 => /lib/i386-linux-gnu/libtinfo.so.6 (0xf7bee000)
$ ldd libpreload.so
        linux-gate.so.1 (0xf7f8f000)
        libstdc++.so.6 => /lib/i386-linux-gnu/libstdc++.so.6 (0xf7d84000)
        libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7d65000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7b81000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7a7d000)
        /lib/ld-linux.so.2 (0xf7f91000)
$ ldd liblua51.so
        linux-gate.so.1 (0xf7f1d000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7d63000)
        libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7d5d000)
        libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7d3e000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7b5a000)
        /lib/ld-linux.so.2 (0xf7f1f000)

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Just try to run it with dontstarve. This message is confusing because you run the 64-bit version of ls so it cannot be loaded.

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Here goes. print(_VERSION) still shows Lua 5.1.

$ LD_PRELOAD=libpreload.so ../dontstarve_steam 
DontStarveLuajit initialized!
Main handle: 0xf7fd8940
Lua51 handle: 0x944c230
LuaJIT handle: 0x9445dd0
Address range 0x8048000 - 0x8520000
[0x8416ab0] (100.00%) [59/59] - Hooked function (0x8416ab0) to (0xf6383ee0) luaL_addlstring
...
[0x84098a0] (78.95%) [45/57] - Hooked function (0x84098a0) to (0xf6344690) lua_createtable
...
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Wed May 20 22:02:49 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
ERROR: ld.so: object 'libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
...
STEAM_RUNTIME is enabled automatically
ERROR: ld.so: object 'libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
...
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
ERROR: ld.so: object 'libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
[00:00:00]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:00]: Error, Steam failed to initialize, result=1...
[00:00:00]: The application will now exit
Updates 0Seconds elapsed: 0.375681 fps:0
[00:00:00]: Shutting down

$ LD_PRELOAD="" ../dontstarve_steam [00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Wed May 20 22:04:20 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments:
[00:00:00]: Initializing distribution platform
Running Steam on debian testing 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
[00:00:01]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:01]: Error, Steam failed to initialize, result=1...
[00:00:01]: The application will now exit
Updates 0Seconds elapsed: 0.378804 fps:0
[00:00:01]: Shutting down

$ LD_PRELOAD=libpreload.so ../dontstarve_dedicated_server_nullrenderer 
DontStarveLuajit initialized!
Main handle: 0xf7f5c940
Lua51 handle: 0x9c24ac0
LuaJIT handle: 0x9c1e660
Address range 0x8048000 - 0x8469000
[0x8391830] (100.00%) [59/59] - Hooked function (0x8391830) to (0xf65d8ee0) luaL_addlstring
...
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/Master/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Wed May 20 22:12:33 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX
[00:00:00]: Build Date: 5879
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
[00:00:00]: ....Done
[00:00:00]: THREAD - started 'GAClient' (4132969280)
[00:00:00]: Error, failed to change working directory to ../data
[00:00:00]: CurlRequestManager::ClientThread::Main()
[00:00:00]: Mounting file system databundles/klump.zip skipped.
[00:00:00]: Mounting file system databundles/shaders.zip skipped.
[00:00:00]: Mounting file system databundles/fonts.zip skipped.
[00:00:00]: Mounting file system databundles/anim_dynamic.zip skipped.
[00:00:00]: Mounting file system databundles/bigportraits.zip skipped.
[00:00:00]: Mounting file system databundles/images.zip skipped.
[00:00:00]: Mounting file system databundles/scripts.zip skipped.
[00:00:00]: ProfileIndex:5.37
[00:00:00]: [Connect] PendingConnection::Reset(true)
[00:00:00]: THREAD - started 'Ping Job Thread' (4126145344)
[00:00:00]: Platform: 1
[00:00:00]: Network tick rate: U=15(2), D=0
[00:00:00]: Network tick rate: U=15(2), D=0
[00:00:00]: Error trying to change cluster setting (NETWORK->cluster_intention) from '' to 'cooperative'
[00:00:00]: OnLoadPermissionList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/blocklist.txt (Failure)
[00:00:00]: OnLoadPermissionList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/adminlist.txt (Failure)
[00:00:00]: THREAD - started 'StreamInput' (4121951040)
[00:00:00]: OnLoadUserIdList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/whitelist.txt (Failure)
[00:00:00]: cGame::InitializeOnMainThread
[00:00:00]: Renderer initialize: Okay
[00:00:00]: AnimManager initialize: Okay
[00:00:00]: Buffers initialize: Okay
[00:00:00]: cDontStarveGame::DoGameSpecificInitialize()
[00:00:00]: GameSpecific initialize: Okay
[00:00:00]: cGame::StartPlaying
[00:00:00]: LOADING LUA
[00:00:00]: DoLuaFile scripts/main.lua
[00:00:00]: DoLuaFile Could not load lua file scripts/main.lua
[00:00:00]: Error loading main.lua
[00:00:00]: Failed mSimulation->Reset()
[00:00:00]: Error during game initialization!
Updates 0Seconds elapsed: 0.0190139 fps:0
Saving Dedicated server data...
[00:00:00]: attempt to call a nil value
stack traceback:
[00:00:00]: attempt to call a nil value
stack traceback:
[00:00:00]: Collecting garbage...
[00:00:00]: lua_gc took 0.00 seconds
[00:00:00]: ~ShardLuaProxy()
[00:00:00]: ~cEventLeaderboardProxy()
[00:00:00]: ~ItemServerLuaProxy()
[00:00:00]: ~InventoryLuaProxy()
[00:00:00]: ~NetworkLuaProxy()
[00:00:00]: ~SimLuaProxy()
[00:00:00]: lua_close took 0.00 seconds
[00:00:00]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager.
[00:00:00]: CurlRequestManager::ClientThread::Main() complete
[00:00:00]: HttpClient2 discarded 0 callbacks.
[00:00:00]: Shutting down

$ LD_PRELOAD="" ../dontstarve_dedicated_server_nullrenderer 
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/Master/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Wed May 20 22:12:19 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX
[00:00:00]: Build Date: 5879
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
[00:00:00]: ....Done
[00:00:00]: THREAD - started 'GAClient' (4133296960)
[00:00:00]: Error, failed to change working directory to ../data
[00:00:00]: CurlRequestManager::ClientThread::Main()
[00:00:00]: Mounting file system databundles/klump.zip skipped.
[00:00:00]: Mounting file system databundles/shaders.zip skipped.
[00:00:00]: Mounting file system databundles/fonts.zip skipped.
[00:00:00]: Mounting file system databundles/anim_dynamic.zip skipped.
[00:00:00]: Mounting file system databundles/bigportraits.zip skipped.
[00:00:00]: Mounting file system databundles/images.zip skipped.
[00:00:00]: Mounting file system databundles/scripts.zip skipped.
[00:00:00]: ProfileIndex:10.18
[00:00:00]: [Connect] PendingConnection::Reset(true)
[00:00:00]: THREAD - started 'Ping Job Thread' (4126145344)
[00:00:00]: Platform: 1
[00:00:00]: Network tick rate: U=15(2), D=0
[00:00:00]: Network tick rate: U=15(2), D=0
[00:00:00]: Error trying to change cluster setting (NETWORK->cluster_intention) from '' to 'cooperative'
[00:00:00]: THREAD - started 'StreamInput' (4121951040)
[00:00:00]: OnLoadPermissionList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/blocklist.txt (Failure)
[00:00:00]: OnLoadPermissionList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/adminlist.txt (Failure)
[00:00:00]: OnLoadUserIdList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/whitelist.txt (Failure)
[00:00:00]: cGame::InitializeOnMainThread
[00:00:00]: Renderer initialize: Okay
[00:00:00]: AnimManager initialize: Okay
[00:00:00]: Buffers initialize: Okay
[00:00:00]: cDontStarveGame::DoGameSpecificInitialize()
[00:00:00]: GameSpecific initialize: Okay
[00:00:00]: cGame::StartPlaying
[00:00:00]: LOADING LUA
[00:00:00]: DoLuaFile scripts/main.lua
[00:00:00]: DoLuaFile Could not load lua file scripts/main.lua
[00:00:00]: Error loading main.lua
[00:00:00]: Failed mSimulation->Reset()
[00:00:00]: Error during game initialization!
Updates 0Seconds elapsed: 0.113709 fps:0
Saving Dedicated server data...
[00:00:00]: attempt to call a nil value
LUA ERROR stack traceback:
[00:00:00]: attempt to call a nil value
LUA ERROR stack traceback:
[00:00:00]: Collecting garbage...
[00:00:00]: lua_gc took 0.00 seconds
[00:00:00]: ~ShardLuaProxy()
[00:00:00]: ~cEventLeaderboardProxy()
[00:00:00]: ~ItemServerLuaProxy()
[00:00:00]: ~InventoryLuaProxy()
[00:00:00]: ~NetworkLuaProxy()
[00:00:00]: ~SimLuaProxy()
[00:00:00]: lua_close took 0.00 seconds
[00:00:00]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager. 
[00:00:00]: CurlRequestManager::ClientThread::Main() complete
[00:00:00]: HttpClient2 discarded 0 callbacks.
[00:00:00]: Shutting down

I was calling those inside bin/lib32/ but now tried in bin, and it is working for the nullrenderer (see Mike Pall's name) but not the game client:

$ LD_PRELOAD=./lib32/libpreload.so ./dontstarve_dedicated_server_nullrenderer 
DontStarveLuajit initialized!
Main handle: 0xf7fbb940
Lua51 handle: 0x98caac0
LuaJIT handle: 0x98c4660
Address range 0x8048000 - 0x8469000
[0x8391830] (100.00%) [59/59] - Hooked function (0x8391830) to (0xf6637ee0) luaL_addlstring
...
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/Master/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Wed May 20 22:14:37 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX
[00:00:00]: Build Date: 5879
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
[00:00:00]: ....Done
[00:00:00]: THREAD - started 'GAClient' (4133358400)
[00:00:00]: CurlRequestManager::ClientThread::Main()
[00:00:00]: Mounting file system databundles/klump.zip successful.
[00:00:00]: Mounting file system databundles/shaders.zip successful.
[00:00:00]: Mounting file system databundles/fonts.zip successful.
[00:00:00]: Mounting file system databundles/anim_dynamic.zip successful.
[00:00:00]: Mounting file system databundles/bigportraits.zip successful.
[00:00:00]: Mounting file system databundles/images.zip successful.
[00:00:00]: Mounting file system databundles/scripts.zip successful.
[00:00:00]: ProfileIndex:5.11
[00:00:00]: [Connect] PendingConnection::Reset(true)
[00:00:00]: THREAD - started 'Ping Job Thread' (4126145344)
[00:00:00]: Platform: 1
[00:00:00]: Network tick rate: U=15(2), D=0
[00:00:00]: Network tick rate: U=15(2), D=0
[00:00:00]: Error trying to change cluster setting (NETWORK->cluster_intention) from '' to 'cooperative'
[00:00:00]: OnLoadPermissionList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/blocklist.txt (Failure)
[00:00:00]: THREAD - started 'StreamInput' (4121951040)
[00:00:00]: OnLoadPermissionList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/adminlist.txt (Failure)
[00:00:00]: OnLoadUserIdList: /home/hyiltiz/.klei//DoNotStarveTogether/Cluster_1/whitelist.txt (Failure)
[00:00:00]: cGame::InitializeOnMainThread
[00:00:00]: Renderer initialize: Okay
[00:00:00]: AnimManager initialize: Okay
[00:00:00]: Buffers initialize: Okay
[00:00:00]: cDontStarveGame::DoGameSpecificInitialize()
[00:00:00]: GameSpecific initialize: Okay
[00:00:00]: cGame::StartPlaying
[00:00:00]: LOADING LUA
[00:00:00]: DoLuaFile scripts/main.lua
[00:00:00]: DoLuaFile loading buffer scripts/main.lua
[00:00:00]:   taskgrouplist:    default Together
[00:00:00]:   taskgrouplist:    classic Classic
[00:00:00]:   taskgrouplist:    cave_default    Underground
[00:00:00]:   taskgrouplist:    lavaarena_taskset       The Forge
[00:00:00]:   taskgrouplist:    quagmire_taskset        The Gorge
[00:00:00]: running main.lua

[00:00:00]: Could not load modindex
[00:00:00]: ModIndex: Beginning normal load sequence for dedicated server.

[00:00:00]: DownloadMods(0)
[00:00:00]: Event data unavailable: lavaarena_event_server/lavaarena_achievement_quest_defs
[00:00:01]: LOADING LUA SUCCESS
[00:00:01]: PlayerDeaths could not load morgue
[00:00:01]: PlayerHistory could not load player_history
[00:00:01]: ServerPreferences could not load server_preferences
[00:00:01]: bloom_enabled       false
[00:00:01]: Could not load saveindex
[00:00:01]: OnFilesLoaded()
[00:00:01]: OnUpdatePurchaseStateComplete
[00:00:01]: Klump load on boot started.
[00:00:01]: Klump files loaded:         0
[00:00:01]:     Load FE
[00:00:02]: THREAD - started 'FilesExistAsyncThread' (4095880000)
[00:00:02]:     Load FE: done
[00:00:02]: FilesExistAsyncThread started (15361 files)...
[00:00:02]: Check for write access: TRUE
[00:00:02]: Check for read access: TRUE
[00:00:02]: ModIndex: Load sequence finished successfully.
[00:00:02]: Reset() returning
[00:00:02]: ... FilesExistAsyncThread complete
[00:00:02]: [200] Account Failed (6): "E_INVALID_TOKEN"
[00:00:02]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[00:00:02]: !!!! Your Server Will Not Start !!!!
[00:00:02]: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[00:00:02]: No auth token could be found.
[00:00:02]: To generate a cluster_token you must
[00:00:02]: open the console from a logged-in game
[00:00:02]: client with the tilda key (~ / �) and type:
[00:00:02]: TheNet:GenerateClusterToken()
[00:00:02]: This will create 'cluster_token.txt' in
[00:00:02]: your client settings directory. Copy this
[00:00:02]: into your cluster settings directory.
[00:00:02]: [Connect] PendingConnection::Reset(true)
print(_VERSION)
[00:00:18]: RemoteCommandInput: "print(_VERSION)"
[00:00:18]: Lua 5.1.4 (LuaJIT by Mike Pall, adapted by PaintDream) Update 2020.4.5
^CUpdates 0Seconds elapsed: 22.7061 fps:0
Saving Dedicated server data...
[00:00:23]: Collecting garbage...
[00:00:23]: lua_gc took 0.04 seconds
[00:00:23]: ~ShardLuaProxy()
[00:00:23]: ~cEventLeaderboardProxy()
[00:00:23]: ~ItemServerLuaProxy()
[00:00:23]: ~InventoryLuaProxy()
[00:00:23]: ~NetworkLuaProxy()
[00:00:23]: ~SimLuaProxy()
[00:00:23]: lua_close took 0.04 seconds
[00:00:23]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager.
[00:00:23]: CurlRequestManager::ClientThread::Main() complete
[00:00:23]: HttpClient2 discarded 0 callbacks.
[00:00:23]: Shutting down

$ LD_PRELOAD=./lib32/libpreload.so ./dontstarve_steam 
DontStarveLuajit initialized!
Main handle: 0xf7f1a940
Lua51 handle: 0x9af2230
LuaJIT handle: 0x9aebdd0
Address range 0x8048000 - 0x8520000
[0x8416ab0] (100.00%) [59/59] - Hooked function (0x8416ab0) to (0xf62c5ee0) luaL_addlstring
...
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Wed May 20 22:16:37 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
ERROR: ld.so: object './lib32/libpreload.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
...
ERROR: ld.so: object './lib32/libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
...
Pins up-to-date!
ERROR: ld.so: object './lib32/libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
...
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
ERROR: ld.so: object './lib32/libpreload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
[00:00:01]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:01]: Error, Steam failed to initialize, result=1...
[00:00:01]: The application will now exit
Updates 0Seconds elapsed: 0.374341 fps:0
[00:00:01]: Shutting down

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Oh, that means libreadline8 is not compatible with libreadline6. World it be OK if I only copy libreadline.so.6 to debian buster? I noticed that libreadline relies on libnurse and several libraries, should I have all of them packed in release?

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Hmm, does libreadline6 needed by the dontstarve_dedicated_server_nullrenderer as well? dontstarve_steam couldn't loaded correctly (as appended in the post above) while dontstarve_dedicated_server_nullrenderer could, though I am guessing they would both use libreadline to deal with the game Console input. Do you see anything else suspicious in the difference between injecting the nullrenderer and the normal game?

Yes, if you see it is just a version compatibility issue of the libreadline library, maybe packing libreadline.so.6 may be the simplest solution. Here is the libreadline dependencies in Debian testing and Debian stable.

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bullseye/sid
Release:        testing
Codename:       bullseye

# apt depends lib32readline8
lib32readline8
  Depends: readline-common
  Depends: lib32tinfo6 (>= 6)
  Depends: libc6-i386 (>= 2.28)

# apt depends readline-common
readline-common
 |Depends: dpkg (>= 1.15.4)
    dpkg:i386
  Depends: install-info
    install-info:i386
  Conflicts: <libreadline-common>
  Conflicts: libreadline5 (<< 5.0-11)
  Suggests: readline-doc
  Replaces: <libreadline-common>
  Replaces: <libreadline4> (<< 4.3-16)
  Replaces: libreadline5 (<< 5.0-11)

==============
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

$ apt depends lib32readline7
lib32readline7
  Depends: readline-common
  Depends: lib32tinfo6 (>= 6)
  Depends: libc6-i386 (>= 2.15)

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Are you trying to start linux game (not dedicated server) with libpreload.so? Oh that's not work since the game requests steam to restart it if it was not started by steam. As a result, LD_PRELOAD will be missing when steam starts it.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Hmm, does libreadline6 needed by the dontstarve_dedicated_server_nullrenderer as well? dontstarve_steam couldn't loaded correctly (as appended in the post above) while dontstarve_dedicated_server_nullrenderer could, though I am guessing they would both use libreadline to deal with the game Console input. Do you see anything else suspicious in the difference between injecting the nullrenderer and the normal game?

Yes, if you see it is just a version compatibility issue of the libreadline library, maybe packing libreadline.so.6 may be the simplest solution. Here is the libreadline dependencies in Debian testing and Debian stable.

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bullseye/sid
Release:        testing
Codename:       bullseye

# apt depends lib32readline8
lib32readline8
  Depends: readline-common
  Depends: lib32tinfo6 (>= 6)
  Depends: libc6-i386 (>= 2.28)

# apt depends readline-common
readline-common
 |Depends: dpkg (>= 1.15.4)
    dpkg:i386
  Depends: install-info
    install-info:i386
  Conflicts: <libreadline-common>
  Conflicts: libreadline5 (<< 5.0-11)
  Suggests: readline-doc
  Replaces: <libreadline-common>
  Replaces: <libreadline4> (<< 4.3-16)
  Replaces: libreadline5 (<< 5.0-11)

==============
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

$ apt depends lib32readline7
lib32readline7
  Depends: readline-common
  Depends: lib32tinfo6 (>= 6)
  Depends: libc6-i386 (>= 2.15)

I would try to pack libreadline.so.6 in latest release, please wait for a moment.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Please try DontStarveLuaJIT.2020.5.20.1.zip on bare buster~ thanks to your help

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Using the same release as before DontStarveLuaJIT.2020.5.20.1.zip, in Debian Buster (stable), installing lib32readline7 package works once symlinked into /lib/i386-linux-gnu/libreadline.so.6; in Debian Bullseye, lib32readline8 also works the same way. Here, "works" mean starting the nullrenderer. As you pointed out earlier, injection doesn't work with standalone game yet.

hyiltiz@instance-1:~$ ./run_servers.sh
ERROR: ld.so: object './lib32/libpreload.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object './lib32/libpreload.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
Caves:  DontStarveLuajit initialized!
Caves:  Main handle: 0xf7fc1950
Caves:  Lua51 handle: 0x8553b70
Caves:  LuaJIT handle: 0x854d710
Caves:  Address range 0x8048000 - 0x8469000
Caves:  [0x8391830] (100.00%) [59/59] - Hooked function (0x8391830) to (0xf670fee0) luaL_addlstring
Caves:  [0x8391880] (80.00%) [32/40] - Hooked function (0x8391880) to (0xf670ff60) luaL_addstring
Caves:  [0x83919e0] (93.22%) [55/59] - Hooked function (0x83919e0) to (0xf6710000) luaL_addvalue
...
Caves:  [00:00:36]: Validating portal[9] <-> 1[9] (active)
Caves:  [00:00:37]: [Shard] Slave LUA is now ready!
Caves:  [00:00:37]: Sim paused
Master: [00:00:45]: Registering master server in US lobby

print(_VERSION)
Master: [00:01:42]: RemoteCommandInput: "print(_VERSION)"
Master: [00:01:42]: Lua 5.1.4 (LuaJIT by Mike Pall, adapted by PaintDream) Update 2020.4.5
...

Can log into that server and play the game just fine.

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Yes! WIth a caveat: all mods are disabled upon game start and clicking "Mods" button crashes the game. Since starting the game from the command line just calls the executable and stops dumping text into the terminal, cannot really see why the game didn't load mods or crashes upon clicking "Mods".

Below I opened it with the workaround, then opened it again without the workaround. Any idea how to get the game to dump info into some file?

> ./dontstarve_steam.bin 
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Thu May 21 00:29:47 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
Running Steam on debian testing 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
[00:00:00]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:00]: Error, Steam failed to initialize, result=1...
[00:00:00]: The application will now exit
Updates 0Seconds elapsed: 0.381743 fps:0
[00:00:00]: Shutting down


> mv dontstarve_steam dontstarve_steam.sh
hyiltiz@iPhone ~/.s/s/s/c/D/bin> mv dontstarve_steam.bin dontstarve_steam
hyiltiz@iPhone ~/.s/s/s/c/D/bin> ./dontstarve_steam
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Thu May 21 00:30:22 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments:
[00:00:00]: Initializing distribution platform
Running Steam on debian testing 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
[00:00:00]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:00]: Error, Steam failed to initialize, result=1...
[00:00:00]: The application will now exit
Updates 0Seconds elapsed: 0.384112 fps:0
[00:00:00]: Shutting down

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

BTW, your steps in the project README.md points to creating a symlink to /lib32. I tried that earlier (but didn't report it to keep us focused). For some reason, it didn't work --- ldd didn't find the library in /lib32. Symlinking into /lib/i386-linux-gnu/` worked. Also, maybe consider automating this Linux setup with a bash script so non-developer players can play the game --- players really shouldn't be scared away from Linux by people like us pushing them to drop to terminal whenever something needs to be done.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Yes! WIth a caveat: all mods are disabled upon game start and clicking "Mods" button crashes the game. Since starting the game from the command line just calls the executable and stops dumping text into the terminal, cannot really see why the game didn't load mods or crashes upon clicking "Mods".

Below I opened it with the workaround, then opened it again without the workaround. Any idea how to get the game to dump info into some file?

> ./dontstarve_steam.bin 
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/ 
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Thu May 21 00:29:47 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments: 
[00:00:00]: Initializing distribution platform
Running Steam on debian testing 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
[00:00:00]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:00]: Error, Steam failed to initialize, result=1...
[00:00:00]: The application will now exit
Updates 0Seconds elapsed: 0.381743 fps:0
[00:00:00]: Shutting down


> mv dontstarve_steam dontstarve_steam.sh
hyiltiz@iPhone ~/.s/s/s/c/D/bin> mv dontstarve_steam.bin dontstarve_steam
hyiltiz@iPhone ~/.s/s/s/c/D/bin> ./dontstarve_steam
[00:00:00]: PersistRootStorage is now /home/hyiltiz/.klei//DoNotStarveTogether/
[00:00:00]: Starting Up
[00:00:00]: Version: 408761
[00:00:00]: Current time: Thu May 21 00:30:22 2020

[00:00:00]: System Name: Linux
[00:00:00]: Host Name: iPhone
[00:00:00]: Release(Kernel) Version: 5.6.0-1-amd64
[00:00:00]: Kernel Build Timestamp: #1 SMP Debian 5.6.7-1 (2020-04-29)
[00:00:00]: Machine Arch: x86_64
[00:00:00]: Don't Starve Together: 408761 LINUX_STEAM
[00:00:00]: Build Date: 4755
[00:00:00]: Mode: 32-bit
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments:
[00:00:00]: Initializing distribution platform
Running Steam on debian testing 64-bit
STEAM_RUNTIME is enabled automatically
Pins up-to-date!
Steam client's requirements are satisfied
/media/hdd/home/hyiltiz/.steam/debian-installation/ubuntu12_32/steam steam://run/322330
[00:00:00]: Steam doesn't seem to be running. Trying to restart the game via Steam.
[00:00:00]: Error, Steam failed to initialize, result=1...
[00:00:00]: The application will now exit
Updates 0Seconds elapsed: 0.384112 fps:0
[00:00:00]: Shutting down

Thanks, I'm planning to check it out when I get off work.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Linux DST version fixed. Please download the latest release at: https://github.com/paintdream/DontStarveLuaJIT/releases/tag/2020.5.21

Linux DS remains broken. It seems that machine code matching goes totally wrong.

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Just did a comparison [1], and it seems I am not really gaining by using LuaJIT. Pretty surprising. Any ideas?

Also, the Mods screen is working now. However, joining a server with the mods enabled crashed once but when I tried again it worked with no issues (guess some lua caches had to be purged?)

[1] https://forums.kleientertainment.com/forums/topic/118355-best-of-both-worlds-less-ram-and-less-lag/?do=findComment&comment=1335453

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

I can't see your images since their links are unavailable in China.
How much RAM is installed on your old linux computer? LuaJIT consumes much more RAM and it is possible that the RAM is insufficient and had to be exchanged from swap partition.
Jit compiler mostly consumes more RAM for generating and caching jitted functions to reduce CPU overload significantly. If your CPU is not bottleneck for game, it will not benefit a lot from jit.

For me, an empty DST world with jit consumes 900MB memory while non-jit version consumes 850MB.
.
BTW, There is another issue about framedrops: #8 in Chinese. It is so strange that it appears only on linux. I guess this framedrop is mainly caused by garbage collection which could stop the world at this issue.

from dontstarveluajit.

paintdream avatar paintdream commented on June 1, 2024

Here's my comparison:

Hardware: Old linux computer purchased on 2012, i7-3610QM (4C8T) + 16 GB DDR3 RAM + Intel HD 4000. My RAM is sufficient for game running and no swap partitions are configured on my linux (Debian 8.5, 64bit).

Lua version (FPS: 48-50, CPU full load on one core, Don't starve is not multi-threaded optimized at all):
lua

LuaJIT version (FPS: 57-58, CPU full load)
luajit

It benefits a lot. With the same full CPU load, luajit can execute 57-58 frames per second while lua version can only do 48-50 frames.

Once paused by mod "Global Pause", it goes to 60fps for both version.

from dontstarveluajit.

hyiltiz avatar hyiltiz commented on June 1, 2024

Hmm, I'll keep an eye on the CPU usage when I do the comparison next time. Is the game too large and not written with optimization in mind s.t. garbage collection accidentally collections stuff that it shouldn't?

from dontstarveluajit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.