Search code examples
prologcygwinswi-prologxserver

SWI-Prolog Guitracer X-server


The following error pops up when I try to use the guitracer to trace my SWI-Prolog code using a cygwin terminal:

[PCE fatal: @display/display: Failed to connect to X-server at `': no DISPLAY environment variable
*********************************************************************
* You MUST be running the X11 Windowing environment.  If you are,   *
* check the setting of your DISPLAY environment variable as well    *
* the access rights to your X11 server.  See xauth(1) and xhost(1). *
*********************************************************************
        in:     <No exception goal> 
]
Host stack: 
[23] pce_principal:send(@3221888617/prolog_debugger, icon(resource(debug)))
[22]  Send-method on @3221888617/prolog_debugger: prolog_debugger->initialise(0,main)
[21] '$c_call_prolog'
[20] pce_principal:send(new(_G397, prolog_debugger(0, main)), open)
[19] prolog_gui:send_pce(prolog_gui:send(new(_G397, prolog_debugger(0, main)), open))

I've tried to change the DISPLAY variable but it then prompts:

[PCE fatal: @display/display: Failed to connect to X-server at `:0.0.': malformed address: :0.0.


  • You MUST be running the X11 Windowing environment. If you are, *
  • check the setting of your DISPLAY environment variable as well *
  • the access rights to your X11 server. See xauth(1) and xhost(1). *


    in:     <No exception goal> ] Host stack:  [23] pce_principal:send(@3221888913/prolog_debugger, icon(resource(debug)))
    

    [22] Send-method on @3221888913/prolog_debugger: prolog_debugger->initialise(0,main) [21] '$c_call_prolog' [20] pce_principal:send(new(_G397, prolog_debugger(0, main)), open) [19] prolog_gui:send_pce(prolog_gui:send(new(_G397, prolog_debugger(0, main)), open))


Solution

  • The program you are executing requires an X11 server to render its output. The environment variable DISPLAY has to point to this X11 server. It's not enough to just define the environment variable. It has to point to an actual implementation of X11.

    On Windows you can use Xming as an implementation of X11.