SWI-Prolog Guitracer X-server

4
当我尝试使用guitracer在cygwin终端中跟踪我的SWI-Prolog代码时,会弹出以下错误:
[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))

我尝试更改DISPLAY变量,但会弹出以下提示:

[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))


1
在cygwin上正确运行SWI-Prolog相当困难。不使用预编译的Windows二进制文件,甚至使用Linux(必要时在虚拟机中)有什么原因吗? - user1812457
2个回答

3

您正在执行的程序需要一个X11服务器来呈现其输出。环境变量DISPLAY必须指向此X11服务器。仅定义环境变量是不够的,它必须指向X11的实际实现。

在Windows上,您可以使用Xming作为X11的实现。


1
我安装了Xming,当我启动它时,在右下角出现了图标和值:0.0。因此可以假设这是要设置DISPLAY变量的值。现在没有错误提示了,但是什么也没有发生,它立即从跟踪中返回并退出swipl命令。然而,运行xeyes确实有效。 - Nickelium

1
通常我在Windows上使用SWI-Prolog,当前版本为Windows 10。
最近我需要在Linux上使用SWI-Prolog,涉及到Unicode问题。
解决方案:
  1. 安装WSL和Ubuntu on Windows
  2. 通过PPA安装SWI-Prolog
版本信息
Windows: 10.0.18362 N/A Build 18362
WSL: 1
Ubuntu: 18.04.2 LTS
SWI-Prolog: (threaded, 64 bits, version 8.1.22)
按照Running Graphical Applications中的指导安装VcXsrv Windows X Server 启动VcXsrv
启动WSL
在WSL上的Ubuntu中运行 $ export DISPLAY=:0
在WSL上的Ubuntu中启动swipl
使用一个查询进行gtrace
这将在Windows 10上启动一个X-Windows客户端,并运行GUI调试器。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接