forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

XOpenDisplay fails

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
KriS



Joined: 13 Nov 2009
Posts: 6

PostPosted: Thu Jan 14, 2010 10:30 am    Post subject: XOpenDisplay fails Reply with quote

Hi,

I'm trying to create a window for my spu software rasterizer (fb approach isn't very crash friendly). I'm using YDL 6.2 distro and GCC 4.3.2.

Code:

int main()
{
    if ( !XOpenDisplay( NULL ) )
    {
        printf( "Can't connect to x server" );
    }

    return 0;
}


Everything works fine when I compile this source with -m32 (32 bit executable), but when I try -m64 XOpenDisplay always returns NULL. I tried to update libX11 (from Fedora repos), reinstalled YDL 6.2, played with xhost, but nothing worked.



EDIT: XOpenDisplay( "NULL" ) -> XOpenDisplay( NULL )


Last edited by KriS on Thu Jan 14, 2010 7:16 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
jbit
Site Admin


Joined: 28 May 2005
Posts: 293
Location: København, Danmark

PostPosted: Thu Jan 14, 2010 6:31 pm    Post subject: Reply with quote

First hit on google for XOpenDisplay: http://tronche.com/gui/x/xlib/display/opening.html
display_name: Specifies the hardware display name, which determines the display and communications domain to be used. On a POSIX-conformant system, if the display_name is NULL, it defaults to the value of the DISPLAY environment variable.

This probably means it wants you to use: XOpenDisplay(NULL);... not passing NULL as a string....

There are plenty of xlib tutorials on the web you should probably read.....
Back to top
View user's profile Send private message Visit poster's website
KriS



Joined: 13 Nov 2009
Posts: 6

PostPosted: Thu Jan 14, 2010 7:15 pm    Post subject: Reply with quote

jbit wrote:
This probably means it wants you to use: XOpenDisplay(NULL);... not passing NULL as a string....


Yes, I'm using XOpenDisplay( NULL ). I also tried ":0.0" (the value of my DISPLAY env variable).

jbit wrote:
There are plenty of xlib tutorials on the web you should probably read.....


I was googling for a 2 days, but couldn't find why XOpenDisplay doesn't work when linking with 64 bit X11 libs.
Back to top
View user's profile Send private message Visit poster's website
cheriff
Regular


Joined: 23 Jun 2004
Posts: 262
Location: Sydney.au

PostPosted: Thu Jan 14, 2010 10:12 pm    Post subject: Reply with quote

is there an 'errno' or similar in xlib you could check for clues on why the call failed?

Maybe an strace would be helpful - sometimes missing file opens or something can be an indicator as to why things failed?

You do have the 64bin xlib library installed right? Although i'd expect some other failure mode if this is the case, but one never knows ...
_________________
Damn, I need a decent signature!
Back to top
View user's profile Send private message
KriS



Joined: 13 Nov 2009
Posts: 6

PostPosted: Sat Jan 16, 2010 8:13 am    Post subject: Reply with quote

cheriff wrote:
Maybe an strace would be helpful - sometimes missing file opens or something can be an indicator as to why things failed?


Thanks for the strace hint. This looks like a really useful tool.

Code:

// 32 bit lib + XOpenDisplay( NULL )
socket(PF_FILE, SOCK_STREAM, 0) = 3
connect(3, {sa_family=AF_FILE, path="/tmp/.X11-unix/X0"...}, 19) = 0

// 32 bit lib + XOpenDisplay( 'localhost.localdomain:0.0" )
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused)

// 64 bit lib + XOpenDisplay with any param
socket(PF_UNSPEC, 0 /* SOCK_??? */, 0)  = 3
connect(0, NULL, 0)                     = -1 ECONNREFUSED (Connection refused)


Calls for the 64bit version look very strange too me. For example manuals don't mention that you can pass NULL as addr to connect.

Also it looks like that I may have some problems with network. I tried to disable firewall, but I can't force 32 bit version to connect to "localhost.localdomain".

cheriff wrote:

You do have the 64bin xlib library installed right? Although i'd expect some other failure mode if this is the case, but one never knows ...


I have reinstalled x11-devel rpms with dependencies and there are some files like libX11.so in lib64 folder. If I remove them I get missing lib errors, so I think I have this lib installed :).
Back to top
View user's profile Send private message Visit poster's website
modrobert



Joined: 12 Apr 2005
Posts: 22
Location: Bangkok

PostPosted: Thu Apr 01, 2010 1:41 am    Post subject: Reply with quote

Try...

xhost+

...and run the program again.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group