blt4linux / blt4l

PAYDAY 2 SteamOS/Linux LUA loader.
Other
57 stars 14 forks source link

libblt_loader.so: undefined symbol: lua_close #108

Closed FuTuL closed 6 years ago

FuTuL commented 6 years ago

Hello The situation is similar to that described in issue #103 . I do not know what the author did to solve this. Now I am having this trouble. I built and manually installed blt4l in accordance with the manual. $ env LD_PRELOAD="$LD_PRELOAD ./libblt_loader.so" ./payday2_release dlHandle = 0x7f6002766170 04:33:23 PM Info: finding lua functions 04:33:23 PM Info: installing hooks szCmd: /bin/sh -c '"/home/futul/.local/share/Steam/steam.sh" "steam://run/218620"' & sh: symbol lookup error: ./libblt_loader.so: undefined symbol: lua_close OS: Ubuntu 18.04 LTS Game version: PAYDAY 2: Update 180.

If you need more information (logs, etc.), I can attach them.

pt300 commented 6 years ago

This is interesting. Lua headers are being included but there's nothing to fill in the declarations nor a library is linked. Yet the functions are being used in code. I feel like there's something missing...

RomanHargrave commented 6 years ago

This is caused by the process you are launching not exporting that symbol. Based on the command output, you are launching PAYDAY2 improperly (it needs some environment variables that steam sets), so it is actually executing steam. The BLT is trying to hook steam and failing.

FuTuL commented 6 years ago

@RomanHargrave I just do not know how to see what's going wrong with running with steam. But in the parameters of the game launch I indicated the following: env LD_PRELOAD = "$ LD_PRELOAD ./libblt_loader.so" %comand% -skip_intro. And blt4l does not running Update: i also try to do: $ env LD_PRELOAD="$LD_PRELOAD ./libblt_loader.so" /home/USERNAME/.local/share/Steam/steam.sh steam://run/218620 /usr/bin/env: symbol lookup error: ./libblt_loader.so: undefined symbol: lua_close As it seemed to me then the steam should set its own variables.

RomanHargrave commented 6 years ago

Make sure it is being run from steam

FuTuL commented 6 years ago

When i press play from steam it's must run from steam. And as I wrote above, I set the startup parameters in the game properties. In this case, the game starts without blt4l and I can not see errors. I performed the console command only to see what was happening. If i just do /home/USERNAME/.local/share/Steam/steam.sh steam://run/218620, then by the external signs of the game runs as from steam

pt300 commented 6 years ago

But if the library is loaded before the process then how can you expect it to get these symbols from the process without doing it manually ( dlsym() )? It would be the process itself using symbols from your library instead of different one if you implemented the functions yourself. Please correct me if I'm wrong.

pt300 commented 6 years ago

And yes, I compiled the code myself and ld shows me a lot of unresolved lua symbols which isn't the case with an old version of libblt_loader.so I have laying on my hdd.

ZNixian commented 6 years ago

But if the library is loaded before the process then how can you expect it to get these symbols from the process without doing it manually ( dlsym() )?

All symbols are resolved by the OS before the constructor runs.

The constructor actually runs after quite a bit of other code, such as initializing variables and getting the dynamic linker ld.so to resolve everything. If you want to know more (and get a headache), look up linker scripts.

And yes, I compiled the code myself and ld shows me a lot of unresolved lua symbols which isn't the case with an old version of libblt_loader.so I have laying on my hdd.

On the old versions the symbols were manually loaded via dllsym.

RomanHargrave commented 6 years ago

@FuTuL please launch payday from the console this way:

env SteamAppId=218620 SteamAppUser=(your steam username) SteamGameId=218620 SteamUser=(your steam username) suppress_restart=1 LD_PRELOAD=(path to libblt_loader.so - cannot have spaces) ./payday2_release

and then post output here.

This is the only correct way to view Payday's log output.

FuTuL commented 6 years ago

@RomanHargrave it's almost works. I saw blt4l. But when I tried to turn on full-screen mode, game crush. Output:

05:37:37 PM Info: finding lua functions
05:37:37 PM Info: installing hooks
Setting breakpad minidump AppID = 218620
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198070957320 [API loaded no]
05:37:38 PM Info: installing BLT LUA API
05:37:38 PM Info: Loading BLT Base
05:37:40 PM Info: Type: 4
05:37:40 PM Info: ref: 5
05:37:40 PM Info: installing BLT LUA API
05:37:40 PM Info: Loading BLT Base
05:37:40 PM Lua: [BLT] Setup...
05:37:40 PM Lua: [BLT] Loading module:  BLTLogs
05:37:40 PM Lua: [BLT] Loading module:  BLTModManager
05:37:40 PM Lua: [BLT] Loading module:  BLTKeybindsManager
05:37:40 PM Lua: [BLT] Loading module:  BLTPersistScripts
05:37:40 PM Lua: [BLT] Loading module:  BLTLocalization
05:37:40 PM Lua: [BLT] Cleaning logs folder, lifetime 1 day(s)
05:37:40 PM Lua: [BLT] Loading mods for state: table: 0x7f4cca7204c0
05:37:40 PM Lua: [BLT] Loading mod: base
05:37:40 PM Lua: [BLT] Loading mod: WolfHUD
05:37:40 PM Lua: [BLT] Setting up mod:  base
05:37:40 PM Lua: [BLT] Setting up mod:  WolfHUD
05:37:40 PM Info: Type: 4
05:37:40 PM Info: ref: 5
05:37:40 PM Info: installing BLT LUA API
05:37:40 PM Info: Loading BLT Base
05:37:40 PM Lua: [BLT] Setup...
05:37:40 PM Lua: [BLT] Loading module:  BLTLogs
05:37:40 PM Lua: [BLT] Loading module:  BLTModManager
05:37:40 PM Lua: [BLT] Loading module:  BLTKeybindsManager
05:37:40 PM Lua: [BLT] Loading module:  BLTPersistScripts
05:37:40 PM Lua: [BLT] Loading module:  BLTLocalization
05:37:40 PM Lua: [BLT] Cleaning logs folder, lifetime 1 day(s)
05:37:40 PM Lua: [BLT] Loading mods for state: table: 0x7f4cca720280
05:37:40 PM Lua: [BLT] Loading mod: base
05:37:40 PM Lua: [BLT] Loading mod: WolfHUD
05:37:40 PM Lua: [BLT] Setting up mod:  base
05:37:40 PM Lua: [BLT] Setting up mod:  WolfHUD
05:37:40 PM Lua: [WolfHUD] ERROR: Error while loading, settings file could not be opened (mods/saves/WolfHUD_v2.json)
05:37:40 PM Info: Type: 4
05:37:40 PM Info: ref: 5
05:37:45 PM Lua: Launching HTTP GET (dest: http://api.paydaymods.com/updates/retrieve/?mod[0]=payday2blt)
05:37:45 PM Lua: Launching HTTP GET (dest: http://api.paydaymods.com/updates/retrieve/?mod[0]=payday2bltdll)
05:37:45 PM Lua: Launching HTTP GET (dest: http://api.paydaymods.com/updates/retrieve/?mod[0]=wolfhud)
05:37:45 PM Lua: Launching HTTP GET (dest: http://api.paydaymods.com/updates/retrieve/?mod[0]=wolfhud_textures)
05:37:45 PM Lua: Launching HTTP GET (dest: http://api.paydaymods.com/updates/retrieve/?mod[0]=fed_inv)
Pure virtual function called!

Update: I checked, WolfHUD was not the cause

RomanHargrave commented 6 years ago

@FuTuL is the issue resolved? What was the problem?

FuTuL commented 6 years ago

@RomanHargrave I don't know what was the problem. But with env SteamAppId=218620 SteamAppUser=(your steam username) SteamGameId=218620 SteamUser=(your steam username) suppress_restart=1 LD_PRELOAD=(path to libblt_loader.so - cannot have spaces) ./payday2_release I can run game with BLT. I don't know why env LD_PRELOAD = "$LD_PRELOAD ./libblt_loader.so" %comand% in game properties doesn't work. I think there's a problem with passing parameters from steam

RomanHargrave commented 6 years ago

if you did indeed put a space between LD_PRELOAD and "$LD_PRELOAD ./libblt_loader.so" that would be a definite cause

FuTuL commented 6 years ago

The space appears when copy-pasting