Monday, December 9, 2013

Compile GLUT with Cygwin required Cygwin/X X Server

Great news for today. I have resolved the problem which occured in the pass few weeks ago. This  note will be the follow up on the problem occured in previous note published in Revisit Opengl With Glut on Linux. I have an OpenGL program develop with GLUT using Eclipse IDE on Windows box. Somehow the EXE doesn't work due to the following error:

This application failed to start because cygwin1.dll was not found. Re-installing the application may fix this problem.

The missing cygwin1.dll is actually located under <CYGWIN_HOME/lib> folder. This error could be resolved easily by putting this path into the environment variable. This is Windows's SOP. After this, there is another error come in complaining that:

freeglut (PROGRAM_NAME): failed to open display ''

This error is a bit tricky. It was due to the Cygwin/X X Server was not install. Ensure the xinit package has install in cygwin, after that launch cygwin terminal, and then type this command startxwin to launch the X Terminal. Then only the EXE can be run. I did try to execute the EXE after xinit package has installed, and also did try executing it under cygwin terminal, but still failed. I think this is due to the EXE was compiled using cygwin compiler, its dependencies will also depends on X Server library, thus causing the EXE must run on top of Cygwin/X X Server.

To prove my statement, I run the same piece of code using VS Express 2012 and the EXE works like charm.

No comments: