Opengles2 sample under X11: binary version works, freshly built - does not

Please provide the following info (check/uncheck the boxes after creating this topic):
Software Version
DRIVE OS Linux 5.2.6
[*] DRIVE OS Linux 5.2.6 and DriveWorks 4.0
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
[*] Linux
QNX
other

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
[*] NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
1.7.0.8846
other

Host Machine Version
[*] native Ubuntu 18.04
other

I have a freshly updated DRIVE AGX with GUI installed (GDM3, Unity) which I’m using remotely (XRDP).
The provided OpenGL example works fine:

nvidia@tegra-ubuntu:~$ drive-t186ref-linux/samples/opengles2/gears/x11/gears
libEGL warning: DRI2: failed to authenticate
 running for 5.000000 seconds...
Total FPS: 161.600006

Obviously, the performance is not great but it works and I can see the three gears rotating.

However, when the same sample does not work if I built it on my own:

nvidia@tegra-ubuntu:~$ ./gears
EGL failed to obtain display.
Usage: gears [options] [runtime]
< ... skip ... >

I built this sample using NVIDIA instructions (which are trivial) without any changes.
Log: make_gears_log (13.0 KB)

Looking at strace output I can see that the working version uses libEGL.so, libEGL_nvidia.so.0 and libEGL_mesa.so.0 but the version built only uses libEGL_nvidia.

It looks like the X11 version was linked not against the generic X11 library but with Nvidia version.
BTW: if I have a monitor connected and it has a GUI on it then my gears app runs within remote window but shows results on the monitor.

Could you please ask your development team to provide a fix to the the built version running in the same way the pre-installed one does?

Dear @user28207,
Did you check ldd output to confirm the linked libs for both? May I know how you confirmed it?

I notice the below linking using ldd on preinstalled binary

nvidia@tegra-ubuntu:~/drive-t186ref-linux/samples/opengles2/gears/x11$ ldd gears
	linux-vdso.so.1 (0x0000007fa424c000)
	libEGL.so => /usr/lib/aarch64-linux-gnu/libEGL.so (0x0000007fa41e9000)
	libGLESv2.so => /usr/lib/aarch64-linux-gnu/libGLESv2.so (0x0000007fa41b3000)
	libX11.so.6 => /usr/lib/aarch64-linux-gnu/libX11.so.6 (0x0000007fa408a000)
	libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007fa405e000)
	libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000007fa3fa5000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007fa3e4b000)
	libGLdispatch.so.0 => /usr/lib/aarch64-linux-gnu/libGLdispatch.so.0 (0x0000007fa3d1f000)
	libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007fa3d0a000)
	/lib/ld-linux-aarch64.so.1 (0x0000007fa4221000)
	libxcb.so.1 => /usr/lib/aarch64-linux-gnu/libxcb.so.1 (0x0000007fa3cda000)
	libXau.so.6 => /usr/lib/aarch64-linux-gnu/libXau.so.6 (0x0000007fa3cc7000)
	libXdmcp.so.6 => /usr/lib/aarch64-linux-gnu/libXdmcp.so.6 (0x0000007fa3cb2000)
	libbsd.so.0 => /lib/aarch64-linux-gnu/libbsd.so.0 (0x0000007fa3c90000)

@SivaRamaKrishnaNV , I used strace and grep its output for all lib:

strace ./gears 2>&1 | grep lib

Dear @user28207,
I notice strace and ldd outputs of shipped and cross compile sample are different. Could you share the strace and ldd command outputs of shipped and cross compile sample on your side?

Hi @SivaRamaKrishnaNV , here we are: the outputs from strace and ldd commands for the shipped (suffix _good) and cross-compiled (suffix _bad) versions:
ldd_bad (2.1 KB)
ldd_good (1.1 KB)
strace_bad (36.0 KB)
strace_good (1.3 MB)

Dear @SivaRamaKrishnaNV , was there any update on that issue? Do you need any other pieces of information?
Thanks!