blakew has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to install OpenGL on a Red Hat Enterprise Linux machine (Linux 2.6.18-194.8.1.el5 x86_64) for a PDL installation. RHEL comes with a really old perl by default so I installed a new one by hand into /usr/local/bin. From what I'm reading it's dubious to "relocate" rpm packages, so I can install a packaged PDL on the system perl but not my local perl unless it was explicitly built to do so. If this is wrong, please inform me as this would be the easiest solution.

Long story short, I'm trying to build PDL from source into my local perl install and it requires OpenGL, whose build in turn requires a display for freeglut which I don't have (a display, that is). This is a "known issue" so I'm not filing a bug. For search purposes here's the error I see when running 'perl Makefile.PL':

freeglut (./glversion): failed to open display ''

The only solution I found to this problem was building OpenGL on a compatible system with a display (here) and altering the Makefile.PL accordingly. I'm not sure how I would go about doing this. Is there a good way to accomplish what I'm trying to do?

Replies are listed 'Best First'.
Re: OpenGL build without display
by Argel (Prior) on Aug 10, 2010 at 20:53 UTC
    You could try something like Xvfb, which is in theory designed for your situation. However, freeglut may be looking for more advanced features, so you may need a real X-server (and one with Open-GL support). If that's the case then try one of the two below instead.

    If you have a system that can function as an X-Windows display server (that your non-X server can reach) you could try setting your DISPLAY to that server. For example:

    display-server> echo $DISPLAY localhost:10.0 display-server> xhost + <code_compiling_server_name_or_ip_address> code-compiling-server> export DISPLAY=display-server:10.0 code-compiling-server> /usr/X11R6/bin/xclock # Test if it works. display-server> xhost - ## Do this after you are done compiling and +testing ##

    Or for X11 Forwarding with SSH (safer/more secure):

    1. On the display server make sure "ForwardX11Trusted" is set to "yes" in /etc/ssh/ssh_config.
    2. On the code compiling server make sure "X11Forwarding" is set to "yes" in /etc/ssh/sshd_config.
      • You may need to do this on the display server as well (been a long time since I had to set this up and that was on Solaris system).
    3. SSH from the display server server to the code compiling server.
      • If things are setup correctly you should have a DISPLAY environment variable automatically set for you on the code compiling server.
      • Test it by running /usr/X11R6/bin/xclock.
    Note: if you manually set the DISPLAY on the code compiling server then it will not be tunneled and you will lose the security advantage of using SSH. And you may need to do the xhost + stuff like in the first example (because that's pretty much the method X11 will be using).

    Elda Taluta; Sarks Sark; Ark Arks

Re: OpenGL build without display
by syphilis (Archbishop) on Aug 11, 2010 at 07:34 UTC
    I'm trying to build PDL from source into my local perl install and it requires OpenGL

    That's not strictly correct - OpenGL is only required if you want your PDL to make use of its graphics capabilities. PDL will still build fine without OpenGL, and there are alternatives to OpenGL re PDL's graphics capabilities (especially on linux, I would think).

    The perldl mailing list would probably be the best place to seek out the details about alternatives.

    Cheers,
    Rob