PDA

View Full Version : X11, libs and getting an Xcode project to work!


scratt
2006-12-10, 13:52
Wonder if anyone can help with this..

I am porting a project which relies on X11 into a native OS X app.

I have all of the source for the project, and have created an Xcode project which compiles and links and produces an executable without errors..

The only dependencies it has (apart from X11) are the OpenGL.framework and the GLUT.framework. It is a console app. So no app bundle.

Whenever I try to run it it drops out with an error when it trys to connect to the 'X server' and open a window context...

I have a full tarball set of source with make files which works on my machine, and produces a console app which will fire up X11 and run perfectly.
So I know this works on my machine in it's current setup.. However, I have missed / borked something in the build process in the Xcode project....

I am pretty sure it is that it simply is not connecting properly to the lib files it depends on for X11 and GL.
Can anyone verify if adding libraries to an Xcode project is as simple as adding them like frameworks, and making them available to the final app? That's all I thought I had to do.... ?

Enki
2006-12-12, 15:17
I dealt with something like this several years ago, unfortunately I don't remember exactly what I did to fix it. And I haven't used X11 since. But I do remember it had to do with properly setting the environment variables when X11 launches. Take a look at the two startup scripts and look for differences there.

Good luck!

colivigan
2006-12-12, 15:59
It does sound like more of a runtime environment issue than a library/linking problem.

Does anything here (http://developer.apple.com/qa/qa2001/qa1232.html) help? In particular, have you tried this?


Q: How do I run X applications from a Terminal window?
A: You can use the /usr/bin/open-x11 script to launch X applications from Terminal.

scratt
2006-12-12, 20:21
Thanks for that guys.. I actually had an epiphany and took the whole app native over the last 24 hours!

However, having gone native with it (even though it is all OpenGL) I have found that the native version runs at about 30 fps and the X11 version was getting 50 fps. Some of this may be because it's in debug mode, but still 20 fps is a lot to lose..

So I am going back to the X11 version to rip it apart. I will give the environment variable stuff a try. Someone else also suggested that it may be as simple as setting the DISPLAY environment variable appropriately in the Executable within my Xcode project that corresponds to my X11 application. So I might give that a try also..