Bug 98555 - NWN won't start on 13.0
Summary: NWN won't start on 13.0
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 13.0
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-02 19:45 UTC by Vasyl Demin
Modified: 2016-11-10 20:53 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Failed tests when I try to build lib32-libdrm on my machine (560 bytes, text/plain)
2016-11-08 08:09 UTC, Vasyl Demin
Details

Description Vasyl Demin 2016-11-02 19:45:01 UTC
NWN won't run after update mesa to 13.0.0.

Archlinux x86_64
Lenovo Thinkpad T510
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
xf86-video-intel 1:2.99.917+722+g714052f-1
mesa 13.0.0-1

% nwn
ERROR: ld.so: object './nwuser64.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
NOTICE: NWLogger: Version: 20080123.212400
NOTICE: NWLogger: Initializing handles.
NOTICE: NWUser: Version 20080123.213207 Successfully loaded. (BaseDir = /opt/nwn)
NOTICE: NWLogger: Patch 0 Address: 0x080b8c0f
NOTICE: NWLogger: Patch 1 Address: 0x082ad068
NOTICE: NWLogger: Patch 2 Address: 0x080be2cf
NOTICE: NWLogger: Patch 3 Address: 0x080c44bb
NOTICE: NWLogger: Patch 4 Address: 0x080c466b
NOTICE: NWLogger: PrePatch0 : 53 8b 45 08 ff 70 08 
NOTICE: NWLogger: PostPatch0: e9 00 41 6c ef 90 90 
NOTICE: NWLogger: PrePatch1 : 56 53 81 ec c8 00 00 00 
NOTICE: NWLogger: PostPatch1: e9 8f fc 4c ef 90 90 90 
NOTICE: NWLogger: PrePatch2 : 56 53 8b 75 08 
NOTICE: NWLogger: PostPatch2: e9 fc e9 6b ef 
NOTICE: NWLogger: PrePatch3 : 53 83 ec 10 a1 54 c3 62 08 
NOTICE: NWLogger: PostPatch3: e9 70 88 6b ef 90 90 90 90 
NOTICE: NWLogger: PrePatch4 : 56 53 83 7d 0c 01 
NOTICE: NWLogger: PostPatch4: e9 74 86 6b ef 90 
NOTICE: NWLogger: Handles Initialized.
NOTICE: NWMovies(./nwmain): Version: 20090223.080954
NOTICE: Looking up symbols in libSDL.....
NOTICE: NWMovies: Using libSDL via RTLD_NEXT.
NOTICE: SDL Library determined to be: /usr/lib32/libSDL-1.2.so.0
NOTICE: NWMovies: SDL_WM_GrabInput() address: f74e4de0
NOTICE: NWMovies: SDL_GetVideoSurface() address: f74e3360
NOTICE: NWMovies: SDL_WM_ToggleFullScreen() address: f74e6200
NOTICE: NWMovies: SDL_PollEvent() address: f74c29b0
NOTICE: NWMovies: SDL_WM_IconifyWindow() address: f74e61d0
NOTICE: NWMovies: Patch 0 Address: 0x08077a9d
NOTICE: NWMovies: Patch 1 Address: 0x08077ab1
NOTICE: NWMovies: Patch 2 Address: 0x0815b5f7
NOTICE: NWMovies: Patch 3 Address: 0x0815b611
NOTICE: NWMovies: Patch 4 Address: 0x0807796f
NOTICE: NWMovies: Patch 5 Address: 0x08207835
NOTICE: NWMovies: Patch 6 Address: 0x08207858
NOTICE: NWMovies: PrePatch0: 8b 80 78 02 00 00 5d c3 
NOTICE: NWMovies: PrePatch1: 8b 80 7c 02 00 00 5d c3 
NOTICE: NWMovies: PrePatch2: e8 68 c5 f1 ff 83 ec 08 
NOTICE: NWMovies: PrePatch3: 169+: eb 59 90 83 
NOTICE: NWMovies: PostPatch0: b8 00 00 00 00 90 5d c3 
NOTICE: NWMovies: PostPatch1: b8 00 00 00 00 90 5d c3 
NOTICE: NWMovies: PostPatch2: 90 90 90 90 90 83 ec 08 
NOTICE: NWMovies: PostPatch3: 169+: 90 90 90 83 
NOTICE: NWMovies: PrePatch4: 56 8d 5d e8 53 
NOTICE: NWMovies: PostPatch4: e9 20 34 71 ef 
NOTICE: NWMovies: MoviesPrePatch: 6a 00 53 bf 00 00 00 3f e8 72 4f 2a 00 8b 43 60 8b 10 c7 04 24 00 00 80 3f 57 57 57 50 ff 52 44 83 c4 1c 
NOTICE: NWMovies: MoviesPostPatch: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 
NOTICE: NWMovies: Initialized.
NOTICE: NWMouse: Using libSDL via RTLD_NEXT.
NOTICE: NWMouse: Version: 20090906.183839
NOTICE: NWMouse: Patch 0 Address: 0x084e9380
NOTICE: NWMouse: Patch 1 Address: 0x084e009c
NOTICE: NWMouse: Patch 2 Address: 0x0863d880
NOTICE: NWMouse: Patch 3 Address: 0x084ffd44
NOTICE: NWMouse: Patch 4 Address: 0x084e3018
NOTICE: NWMouse: Patch 5 Address: 0x084e05b7
NOTICE: NWMouse: Patch 6 Address: 0x084e8440
NOTICE: NWMouse: Stop pointer: 0x084e9380
NOTICE: NWMouse: Table Address: 0x0863d880
NOTICE: NWMouse: Table Length: 89
NOTICE: NWMouse: Render function replaced in secondary table, offset: 6
NOTICE: NWMouse: Texture function replaced in secondary table, offset: 13.
NOTICE: NWMouse: Orientation function replaced in secondary table, offset: 25.
NOTICE: NWMouse: Original Table: 80 d8 63 08 
NOTICE: NWMouse: Pushed: 54 2a 7c 08 
NOTICE: NWMouse: PreMod1: c7 40 0c 80 d8 63 08 
NOTICE: NWMouse: PostMod1: e9 6d c8 2b ef 90 90 
NOTICE: NWMouse: PreMod2: ff 05 68 d8 63 08 
NOTICE: NWMouse: PostMod2: e9 99 c3 2b ef 08 83 
NOTICE: NWMouse: Initialized.
NOTICE: NWLogger: mkdir(/home/vdemin/.nwn/./tempclient/, 0777) caught
NOTICE: NWLogger: mkdir(/home/vdemin/.nwn/./localvault/, 0777) caught
NOTICE: NWLogger: mkdir(/home/vdemin/.nwn/./dmvault/, 0777) caught
NOTICE: NWLogger: mkdir(/home/vdemin/.nwn/./servervault/, 0777) caught
NOTICE: SDL_WM_GrabInput(QUERY) called..
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: Version 4 or later of flush extension not found
libGL error: failed to load driver: i915
libGL error: MESA-LOADER: failed to retrieve device information
NOTICE: SDL_WM_GrabInput(OFF) called..
%
Comment 1 Emil Velikov 2016-11-04 18:00:09 UTC
Don't think this is i965 specific since we fail at the loader level. 
You should be able to reproduce with simple glxgears.

We had a few bugs in the older libdrm - can you try rebuilding from master https://cgit.freedesktop.org/mesa/drm

If that doesn't cut it I'll prep some debugging patch to see why/how drmGetDevice() fails on your system... Speaking of which is it a optimus system, are you trying to change between GPU's via DRI_PRIME or driconf ?
Comment 2 Alan Swanson 2016-11-05 16:07:07 UTC
Same error occurs with amdgpu running libdrm 2.4.71 and mesa git. However issue  only occurrs when using NWUser which wraps various file and dir functions to provide per user settings and saves. Haven't played NWN for a while so don't know when started occurring.

libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
Comment 3 Nicolai Hähnle 2016-11-07 11:37:37 UTC
amdgpu_dri.so is the name of the amdgpu-pro (closed-source) OpenGL driver. Since you seem to be trying to use Mesa, please make sure to remove the amdgpu-pro installation.
Comment 4 Emil Velikov 2016-11-07 11:54:41 UTC
The most likely thing that comes to mind is that one LD_PRELOADs a bunch of libraries, amongst which an older version of libdrm.

What's the output of $LD_DEBUG=libs nwn
The above can be a bit large so please attach as plain text.

Or maybe it's this nasty LD_PRELOAD [1] which overrides open/opendir/stat/etc. in a slightly brain-dead manner. I'm sure that mangling _every_ path is a good _not_ a idea.

[1] https://github.com/nwnlinux/nwuser
Comment 5 Emil Velikov 2016-11-07 14:04:26 UTC
s/good _not_/_not_ good/ of course.

Or to put it otherwise - __nwu_possible() [1] should attribute only for files/directories which are known used by NWM. Everything else must remain as-is.

[1] https://github.com/nwnlinux/nwuser/blob/master/nwuser/util.c#L94
Comment 6 Laurent carlier 2016-11-07 16:04:56 UTC
Just tried with my own copy of nwn (resurected from my hard drive) and it starts perfectly (archlinux/mesa-git/llvm-svn) with radeonsi
Comment 7 Alan Swanson 2016-11-07 16:19:04 UTC
Might be that __nwu_possible return value isn't checked for the opendir override. Will have a look in a day or two but unlikely to be a mesa bug.

Unfortunately NWN was written/ported without any consideration for local saves and expected to write into the game directory so overrides were the only option. There are no old or game included libraries on my system and amdgpu-pro has never been installed rather that's just what libgl/libdrm barfs.
Comment 8 Emil Velikov 2016-11-07 17:19:20 UTC
Skimming through __nwu_possible - I might have gone overboard calling it "brain dead". Sorry about that :-\

That said, please check if the issue persists without the nwuser wrapper. If so, feel free to reopen. Thanks!
Comment 9 Vasyl Demin 2016-11-08 08:06:46 UTC
Hello Emil, thanks for quick response and sorry for my late reply.

> You should be able to reproduce with simple glxgears.
glxgears and glxgears32 both work fine on intel card.

> can you try rebuilding from master https://cgit.freedesktop.org/mesa/drm
I can not build neither lib32-libdrm-git nor lib32-libdrm 2.4.71 at this moment:
...
PASS: drmsl
PASS: hash
PASS: random
PASS: openclose
../build-aux/test-driver: line 107: 22768 Segmentation fault      (core dumped) "$@" > $log_file 2>&1
FAIL: getversion
../build-aux/test-driver: line 107: 22796 Aborted                 (core dumped) "$@" > $log_file 2>&1
FAIL: getclient
../build-aux/test-driver: line 107: 22827 Aborted                 (core dumped) "$@" > $log_file 2>&1
FAIL: getstats
PASS: setversion
PASS: updatedraw
PASS: name_from_fd
============================================================================
Testsuite summary for libdrm 2.4.71
============================================================================
# TOTAL: 10
# PASS:  7
# SKIP:  0
# XFAIL: 0
# FAIL:  3
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Please report to https://bugs.freedesktop.org/enter_bug.cgi?product=DRI
============================================================================

Should I open a separate bug?

> If that doesn't cut it I'll prep some debugging patch to see why/how drmGetDevice() fails on your system...
It would be great.

> Speaking of which is it a optimus system, are you trying to change between GPU's via DRI_PRIME or driconf ?
I'm using nvidia blob for discrete card, NWN works fine when running with optirun.
Comment 10 Vasyl Demin 2016-11-08 08:09:28 UTC
Created attachment 127832 [details]
Failed tests when I try to build lib32-libdrm on my machine
Comment 11 Emil Velikov 2016-11-10 19:11:42 UTC
(In reply to Vasyl Demin from comment #9)
> Hello Emil, thanks for quick response and sorry for my late reply.
> 
> > You should be able to reproduce with simple glxgears.
> glxgears and glxgears32 both work fine on intel card.
> 
> > can you try rebuilding from master https://cgit.freedesktop.org/mesa/drm
> I can not build neither lib32-libdrm-git nor lib32-libdrm 2.4.71 at this
> moment:
> ...
> PASS: drmsl
> PASS: hash
> PASS: random
> PASS: openclose
> ../build-aux/test-driver: line 107: 22768 Segmentation fault      (core
> dumped) "$@" > $log_file 2>&1
> FAIL: getversion
These are tests [which we ought to remove since they're irrelevant]. Pretty sure things build just fine without it ;-) Just drop the checks section in the build script.

As mentioned in comment 8, I'm leaning that this is a nwuser issue with the prime suspect this [1] unchecked call of __nwu_possible().

Can you [temporary] try without the wrapper ?

https://github.com/nwnlinux/nwuser/blob/3fbbf546a8ba9cc1e35ba5a718018402baaa658d/nwuser/dirs.c#L50
Comment 12 Alan Swanson 2016-11-10 19:50:49 UTC
There's a patch for nwuser to check __nwu_possible in its opendir override;

https://github.com/nwnlinux/nwuser/pull/1

Unfortunately with radeonsi I now get a segfault at gelf_getshdr (called via si_init_shader_selector_async si_compile_tgsi_shader si_compile_llvm radeon_elf_read) which only happens when nwuser is being used. Again, not a mesa bug. I'll try and fix it too but the last time I'd run NWN until this bug was with r600.
Comment 13 Vasyl Demin 2016-11-10 20:00:03 UTC
@Emil
Sorry, I did not check it before. You are right, NWN run normally without nwuser.so and nwuser64.so in LD_PRELOAD. 

@Alan
Thanks, I will try your patch.
Comment 14 Emil Velikov 2016-11-10 20:53:34 UTC
(In reply to Vasyl Demin from comment #13)
> @Emil
> Sorry, I did not check it before. You are right, NWN run normally without
> nwuser.so and nwuser64.so in LD_PRELOAD. 
> 
Great, thanks for the confirmation.

If you use something like LD_PRELOAD='/foo/$LIB/nwuser.so' in your nwn script the linker will expand $LIBS accordingly and use the correct file. Sparing you the "wrong ELF class: " message... in theory at least ;-)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.