Xopendisplay returns segmentation fault

I currently did a sample multi threaded code using Xlib and sdl to make two separate child windows. It works well in X86 architecture. I cross compiled same code for ARM and built executables. I tried this executables in R CAR-E2 Board, some errors occurred. Mostly segmentation fault occurred. Some times, window got created using xlib, persists for a very short time and exits, while window created using sdl works successfully. I already set DISPLAY environment variables to :0.0 and crosschecked. When the program was debugged, it was found that Xopendisplay makes this error.

Is XAUTHORITY environment variable making such issue?

When I checked XAUTHORITY variable, it was not set (Xauthority file was not found). Please anyone suggest a solution for this problem.
Thanks in Advance